@ahmed-g-gad/apothem 0.1.1

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 (674) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/LICENSE +21 -0
  3. package/LICENSES/MIT.txt +18 -0
  4. package/LICENSES/PSF-2.0.txt +47 -0
  5. package/README.md +549 -0
  6. package/bin/README.md +37 -0
  7. package/bin/apothem.mjs +78 -0
  8. package/package.json +75 -0
  9. package/pyproject.toml +347 -0
  10. package/src/apothem/README.md +52 -0
  11. package/src/apothem/__init__.py +66 -0
  12. package/src/apothem/__main__.py +28 -0
  13. package/src/apothem/_vendor/.keep +0 -0
  14. package/src/apothem/_vendor/__init__.py +25 -0
  15. package/src/apothem/_vendor/attr/__init__.py +104 -0
  16. package/src/apothem/_vendor/attr/__init__.pyi +389 -0
  17. package/src/apothem/_vendor/attr/_cmp.py +160 -0
  18. package/src/apothem/_vendor/attr/_cmp.pyi +13 -0
  19. package/src/apothem/_vendor/attr/_compat.py +99 -0
  20. package/src/apothem/_vendor/attr/_config.py +31 -0
  21. package/src/apothem/_vendor/attr/_funcs.py +497 -0
  22. package/src/apothem/_vendor/attr/_make.py +3406 -0
  23. package/src/apothem/_vendor/attr/_next_gen.py +674 -0
  24. package/src/apothem/_vendor/attr/_typing_compat.pyi +15 -0
  25. package/src/apothem/_vendor/attr/_version_info.py +89 -0
  26. package/src/apothem/_vendor/attr/_version_info.pyi +9 -0
  27. package/src/apothem/_vendor/attr/converters.py +162 -0
  28. package/src/apothem/_vendor/attr/converters.pyi +19 -0
  29. package/src/apothem/_vendor/attr/exceptions.py +95 -0
  30. package/src/apothem/_vendor/attr/exceptions.pyi +17 -0
  31. package/src/apothem/_vendor/attr/filters.py +72 -0
  32. package/src/apothem/_vendor/attr/filters.pyi +6 -0
  33. package/src/apothem/_vendor/attr/py.typed +0 -0
  34. package/src/apothem/_vendor/attr/setters.py +79 -0
  35. package/src/apothem/_vendor/attr/setters.pyi +20 -0
  36. package/src/apothem/_vendor/attr/validators.py +750 -0
  37. package/src/apothem/_vendor/attr/validators.pyi +140 -0
  38. package/src/apothem/_vendor/attr.LICENSE +21 -0
  39. package/src/apothem/_vendor/attrs/__init__.py +72 -0
  40. package/src/apothem/_vendor/attrs/__init__.pyi +314 -0
  41. package/src/apothem/_vendor/attrs/converters.py +3 -0
  42. package/src/apothem/_vendor/attrs/exceptions.py +3 -0
  43. package/src/apothem/_vendor/attrs/filters.py +3 -0
  44. package/src/apothem/_vendor/attrs/py.typed +0 -0
  45. package/src/apothem/_vendor/attrs/setters.py +3 -0
  46. package/src/apothem/_vendor/attrs/validators.py +3 -0
  47. package/src/apothem/_vendor/attrs.LICENSE +21 -0
  48. package/src/apothem/_vendor/jsonschema/__init__.py +120 -0
  49. package/src/apothem/_vendor/jsonschema/__main__.py +6 -0
  50. package/src/apothem/_vendor/jsonschema/_format.py +546 -0
  51. package/src/apothem/_vendor/jsonschema/_keywords.py +449 -0
  52. package/src/apothem/_vendor/jsonschema/_legacy_keywords.py +449 -0
  53. package/src/apothem/_vendor/jsonschema/_types.py +204 -0
  54. package/src/apothem/_vendor/jsonschema/_typing.py +29 -0
  55. package/src/apothem/_vendor/jsonschema/_utils.py +355 -0
  56. package/src/apothem/_vendor/jsonschema/benchmarks/__init__.py +5 -0
  57. package/src/apothem/_vendor/jsonschema/benchmarks/const_vs_enum.py +30 -0
  58. package/src/apothem/_vendor/jsonschema/benchmarks/contains.py +28 -0
  59. package/src/apothem/_vendor/jsonschema/benchmarks/import_benchmark.py +31 -0
  60. package/src/apothem/_vendor/jsonschema/benchmarks/issue232/issue.json +2653 -0
  61. package/src/apothem/_vendor/jsonschema/benchmarks/issue232.py +25 -0
  62. package/src/apothem/_vendor/jsonschema/benchmarks/json_schema_test_suite.py +12 -0
  63. package/src/apothem/_vendor/jsonschema/benchmarks/nested_schemas.py +56 -0
  64. package/src/apothem/_vendor/jsonschema/benchmarks/subcomponents.py +42 -0
  65. package/src/apothem/_vendor/jsonschema/benchmarks/unused_registry.py +35 -0
  66. package/src/apothem/_vendor/jsonschema/benchmarks/useless_applicator_schemas.py +106 -0
  67. package/src/apothem/_vendor/jsonschema/benchmarks/useless_keywords.py +32 -0
  68. package/src/apothem/_vendor/jsonschema/benchmarks/validator_creation.py +14 -0
  69. package/src/apothem/_vendor/jsonschema/cli.py +292 -0
  70. package/src/apothem/_vendor/jsonschema/exceptions.py +490 -0
  71. package/src/apothem/_vendor/jsonschema/protocols.py +230 -0
  72. package/src/apothem/_vendor/jsonschema/validators.py +1410 -0
  73. package/src/apothem/_vendor/jsonschema.LICENSE +19 -0
  74. package/src/apothem/_vendor/jsonschema_specifications/__init__.py +12 -0
  75. package/src/apothem/_vendor/jsonschema_specifications/_core.py +38 -0
  76. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft201909/metaschema.json +42 -0
  77. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft201909/vocabularies/applicator +56 -0
  78. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft201909/vocabularies/content +17 -0
  79. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft201909/vocabularies/core +57 -0
  80. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft201909/vocabularies/format +14 -0
  81. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft201909/vocabularies/meta-data +37 -0
  82. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft201909/vocabularies/validation +98 -0
  83. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft202012/metaschema.json +58 -0
  84. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft202012/vocabularies/applicator +48 -0
  85. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft202012/vocabularies/content +17 -0
  86. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft202012/vocabularies/core +51 -0
  87. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft202012/vocabularies/format-annotation +14 -0
  88. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft202012/vocabularies/format-assertion +14 -0
  89. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft202012/vocabularies/meta-data +37 -0
  90. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft202012/vocabularies/unevaluated +15 -0
  91. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft202012/vocabularies/validation +98 -0
  92. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft3/metaschema.json +172 -0
  93. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft4/metaschema.json +149 -0
  94. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft6/metaschema.json +153 -0
  95. package/src/apothem/_vendor/jsonschema_specifications/schemas/draft7/metaschema.json +166 -0
  96. package/src/apothem/_vendor/jsonschema_specifications.LICENSE +19 -0
  97. package/src/apothem/_vendor/referencing/__init__.py +7 -0
  98. package/src/apothem/_vendor/referencing/_attrs.py +31 -0
  99. package/src/apothem/_vendor/referencing/_attrs.pyi +21 -0
  100. package/src/apothem/_vendor/referencing/_core.py +739 -0
  101. package/src/apothem/_vendor/referencing/exceptions.py +165 -0
  102. package/src/apothem/_vendor/referencing/jsonschema.py +642 -0
  103. package/src/apothem/_vendor/referencing/py.typed +0 -0
  104. package/src/apothem/_vendor/referencing/retrieval.py +94 -0
  105. package/src/apothem/_vendor/referencing/typing.py +61 -0
  106. package/src/apothem/_vendor/referencing.LICENSE +19 -0
  107. package/src/apothem/_vendor/rpds/__init__.py +251 -0
  108. package/src/apothem/_vendor/typing_extensions.LICENSE +279 -0
  109. package/src/apothem/_vendor/typing_extensions.py +4317 -0
  110. package/src/apothem/_vendor/vendor.txt +22 -0
  111. package/src/apothem/_vendor/yaml/__init__.py +389 -0
  112. package/src/apothem/_vendor/yaml/composer.py +138 -0
  113. package/src/apothem/_vendor/yaml/constructor.py +748 -0
  114. package/src/apothem/_vendor/yaml/cyaml.py +100 -0
  115. package/src/apothem/_vendor/yaml/dumper.py +61 -0
  116. package/src/apothem/_vendor/yaml/emitter.py +1137 -0
  117. package/src/apothem/_vendor/yaml/error.py +74 -0
  118. package/src/apothem/_vendor/yaml/events.py +85 -0
  119. package/src/apothem/_vendor/yaml/loader.py +63 -0
  120. package/src/apothem/_vendor/yaml/nodes.py +48 -0
  121. package/src/apothem/_vendor/yaml/parser.py +588 -0
  122. package/src/apothem/_vendor/yaml/reader.py +185 -0
  123. package/src/apothem/_vendor/yaml/representer.py +388 -0
  124. package/src/apothem/_vendor/yaml/resolver.py +226 -0
  125. package/src/apothem/_vendor/yaml/scanner.py +1435 -0
  126. package/src/apothem/_vendor/yaml/serializer.py +110 -0
  127. package/src/apothem/_vendor/yaml/tokens.py +103 -0
  128. package/src/apothem/_vendor/yaml.LICENSE +20 -0
  129. package/src/apothem/agents/README.md +60 -0
  130. package/src/apothem/agents/codebase-explorer.md +91 -0
  131. package/src/apothem/agents/convention-auditor.md +93 -0
  132. package/src/apothem/agents/dependency-auditor.md +97 -0
  133. package/src/apothem/agents/fact-checker.md +84 -0
  134. package/src/apothem/agents/mcp-builder.md +86 -0
  135. package/src/apothem/agents/memory-auditor.md +93 -0
  136. package/src/apothem/agents/prompt-evaluator.md +87 -0
  137. package/src/apothem/agents/quality-gate.md +103 -0
  138. package/src/apothem/agents/refactor-surgeon.md +74 -0
  139. package/src/apothem/agents/research-scout.md +73 -0
  140. package/src/apothem/agents/security-scanner.md +83 -0
  141. package/src/apothem/agents/test-runner.md +84 -0
  142. package/src/apothem/audit/README.md +73 -0
  143. package/src/apothem/audit/_scan_lib.py +182 -0
  144. package/src/apothem/audit/analyze_graph.py +260 -0
  145. package/src/apothem/audit/build_capability_graph.py +607 -0
  146. package/src/apothem/audit/build_inventory.py +657 -0
  147. package/src/apothem/audit/build_plans_provenance.py +997 -0
  148. package/src/apothem/audit/check_links.py +389 -0
  149. package/src/apothem/audit/classify_artifacts.py +381 -0
  150. package/src/apothem/audit/deprecated-tokens.txt +10 -0
  151. package/src/apothem/audit/execute_plans_migration.py +491 -0
  152. package/src/apothem/audit/known-projects.txt +15 -0
  153. package/src/apothem/audit/render_capability_index.py +467 -0
  154. package/src/apothem/audit/render_inventory.py +405 -0
  155. package/src/apothem/audit/scan_ai_surfaces.py +1125 -0
  156. package/src/apothem/audit/scan_ai_surfaces_coarse.py +261 -0
  157. package/src/apothem/audit/scan_drift_features.py +143 -0
  158. package/src/apothem/audit/scan_frontmatter.py +293 -0
  159. package/src/apothem/audit/scan_header_coverage.py +1134 -0
  160. package/src/apothem/audit/scan_plan_leakage.py +540 -0
  161. package/src/apothem/audit/scan_plans_discipline.py +188 -0
  162. package/src/apothem/audit/scan_secrets_pii.py +245 -0
  163. package/src/apothem/audit/scan_stale_tokens.py +296 -0
  164. package/src/apothem/audit/synthesize_drift.py +205 -0
  165. package/src/apothem/benchmarks/README.md +33 -0
  166. package/src/apothem/benchmarks/__init__.py +3 -0
  167. package/src/apothem/benchmarks/bench_agents.py +63 -0
  168. package/src/apothem/benchmarks/bench_hooks.py +93 -0
  169. package/src/apothem/benchmarks/bench_install.py +58 -0
  170. package/src/apothem/benchmarks/bench_tests.py +93 -0
  171. package/src/apothem/benchmarks/bench_validate_ecosystem.py +84 -0
  172. package/src/apothem/cli/README.md +33 -0
  173. package/src/apothem/cli/__init__.py +229 -0
  174. package/src/apothem/cli/_cmd_completion.py +88 -0
  175. package/src/apothem/cli/_cmd_diff.py +181 -0
  176. package/src/apothem/cli/_cmd_doctor.py +143 -0
  177. package/src/apothem/cli/_cmd_harnesses.py +167 -0
  178. package/src/apothem/cli/_cmd_install.py +327 -0
  179. package/src/apothem/cli/_cmd_migrate_workspace.py +143 -0
  180. package/src/apothem/cli/_cmd_profile.py +341 -0
  181. package/src/apothem/cli/_cmd_status.py +180 -0
  182. package/src/apothem/cli/_cmd_uninstall.py +215 -0
  183. package/src/apothem/cli/_cmd_update.py +397 -0
  184. package/src/apothem/cli/_cmd_verify.py +194 -0
  185. package/src/apothem/cli/_common_flags.py +90 -0
  186. package/src/apothem/cli/_epilogs.py +296 -0
  187. package/src/apothem/cli/_helpers.py +857 -0
  188. package/src/apothem/cli/_json_formatter.py +21 -0
  189. package/src/apothem/cli/_materialize.py +376 -0
  190. package/src/apothem/cli/completions/apothem.bash +30 -0
  191. package/src/apothem/cli/completions/apothem.fish +19 -0
  192. package/src/apothem/cli/completions/apothem.ps1 +27 -0
  193. package/src/apothem/cli/completions/apothem.zsh +42 -0
  194. package/src/apothem/cli/reference_export.py +126 -0
  195. package/src/apothem/commands/README.md +125 -0
  196. package/src/apothem/commands/a11y-audit.md +203 -0
  197. package/src/apothem/commands/architecture-review.md +194 -0
  198. package/src/apothem/commands/audit.md +165 -0
  199. package/src/apothem/commands/code-audit.md +218 -0
  200. package/src/apothem/commands/code-review.md +193 -0
  201. package/src/apothem/commands/dependency-audit.md +209 -0
  202. package/src/apothem/commands/docs-review.md +199 -0
  203. package/src/apothem/commands/elevate.md +285 -0
  204. package/src/apothem/commands/eval.md +149 -0
  205. package/src/apothem/commands/fortress.md +172 -0
  206. package/src/apothem/commands/freshify.md +168 -0
  207. package/src/apothem/commands/github-deploy-fresh.md +178 -0
  208. package/src/apothem/commands/github-deploy-next.md +167 -0
  209. package/src/apothem/commands/perf-audit.md +198 -0
  210. package/src/apothem/commands/plan-amend.md +104 -0
  211. package/src/apothem/commands/plan-audit.md +127 -0
  212. package/src/apothem/commands/plan-design.md +257 -0
  213. package/src/apothem/commands/plan-execute.md +495 -0
  214. package/src/apothem/commands/plan-generate.md +351 -0
  215. package/src/apothem/commands/plan-review.md +555 -0
  216. package/src/apothem/commands/plan-spec.md +359 -0
  217. package/src/apothem/commands/plan-status.md +222 -0
  218. package/src/apothem/commands/plan.md +173 -0
  219. package/src/apothem/commands/projectify.md +142 -0
  220. package/src/apothem/commands/release-readiness.md +142 -0
  221. package/src/apothem/commands/research-analysis.md +241 -0
  222. package/src/apothem/commands/research-design.md +231 -0
  223. package/src/apothem/commands/research-disseminate.md +225 -0
  224. package/src/apothem/commands/research-experiment.md +232 -0
  225. package/src/apothem/commands/research-ideate.md +213 -0
  226. package/src/apothem/commands/research-paper.md +252 -0
  227. package/src/apothem/commands/research-proposal.md +220 -0
  228. package/src/apothem/commands/research-publish.md +255 -0
  229. package/src/apothem/commands/research-review.md +251 -0
  230. package/src/apothem/commands/research-sources.md +266 -0
  231. package/src/apothem/commands/research-spec.md +255 -0
  232. package/src/apothem/commands/research-synthesis.md +233 -0
  233. package/src/apothem/commands/research-theory.md +218 -0
  234. package/src/apothem/commands/research.md +181 -0
  235. package/src/apothem/commands/security-audit.md +196 -0
  236. package/src/apothem/commands/supply-chain-audit.md +192 -0
  237. package/src/apothem/commands/test-suite.md +146 -0
  238. package/src/apothem/commands/threat-model-audit.md +199 -0
  239. package/src/apothem/commands/ux-review.md +202 -0
  240. package/src/apothem/commands/workflow.md +162 -0
  241. package/src/apothem/conformity/README.md +173 -0
  242. package/src/apothem/conformity/__init__.py +1 -0
  243. package/src/apothem/conformity/_grep_base.py +93 -0
  244. package/src/apothem/conformity/agent_capability_grep.py +306 -0
  245. package/src/apothem/conformity/agents_md_coverage_grep.py +382 -0
  246. package/src/apothem/conformity/agnosticism_grep.py +311 -0
  247. package/src/apothem/conformity/always_on_budget_grep.py +318 -0
  248. package/src/apothem/conformity/bare_except_grep.py +115 -0
  249. package/src/apothem/conformity/binding_reciprocity_grep.py +151 -0
  250. package/src/apothem/conformity/brand_mark_grep.py +272 -0
  251. package/src/apothem/conformity/commented_out_code_grep.py +176 -0
  252. package/src/apothem/conformity/completion_claim_grep.py +169 -0
  253. package/src/apothem/conformity/conventional_commit_grep.py +319 -0
  254. package/src/apothem/conformity/copilot_instructions_presence_grep.py +324 -0
  255. package/src/apothem/conformity/cross_platform_matrix_grep.py +297 -0
  256. package/src/apothem/conformity/determinism_grep.py +306 -0
  257. package/src/apothem/conformity/diagram_staleness_grep.py +154 -0
  258. package/src/apothem/conformity/dynamism_grep.py +284 -0
  259. package/src/apothem/conformity/editorconfig_presence_grep.py +281 -0
  260. package/src/apothem/conformity/file_header_grep.py +502 -0
  261. package/src/apothem/conformity/freshness_token_grep.py +233 -0
  262. package/src/apothem/conformity/frontmatter_grep.py +274 -0
  263. package/src/apothem/conformity/frontmatter_value_grep.py +386 -0
  264. package/src/apothem/conformity/gate.py +1386 -0
  265. package/src/apothem/conformity/gitattributes_presence_grep.py +238 -0
  266. package/src/apothem/conformity/harden_runner_grep.py +320 -0
  267. package/src/apothem/conformity/hedging_grep.py +129 -0
  268. package/src/apothem/conformity/license_author_consistency_grep.py +204 -0
  269. package/src/apothem/conformity/link_check.py +327 -0
  270. package/src/apothem/conformity/magic_number_grep.py +182 -0
  271. package/src/apothem/conformity/multi_surface_coherence_grep.py +620 -0
  272. package/src/apothem/conformity/naming_grep.py +224 -0
  273. package/src/apothem/conformity/no_global_plans_grep.py +339 -0
  274. package/src/apothem/conformity/no_toplevel_docs_grep.py +120 -0
  275. package/src/apothem/conformity/oidc_trusted_publishing_grep.py +291 -0
  276. package/src/apothem/conformity/option_annotation_grep.py +352 -0
  277. package/src/apothem/conformity/orphan_output_grep.py +206 -0
  278. package/src/apothem/conformity/permissions_minimum_scope_grep.py +299 -0
  279. package/src/apothem/conformity/plain_language_grep.py +559 -0
  280. package/src/apothem/conformity/plan_next_step_consistency_grep.py +450 -0
  281. package/src/apothem/conformity/plan_suite_structure_grep.py +534 -0
  282. package/src/apothem/conformity/plans_discipline_language_grep.py +245 -0
  283. package/src/apothem/conformity/production_ready_pr_grep.py +200 -0
  284. package/src/apothem/conformity/recommend_next_step_grep.py +250 -0
  285. package/src/apothem/conformity/redundancy_grep.py +401 -0
  286. package/src/apothem/conformity/reference_token_grep.py +230 -0
  287. package/src/apothem/conformity/registry_capability_consistency_grep.py +368 -0
  288. package/src/apothem/conformity/secret_leak_grep.py +193 -0
  289. package/src/apothem/conformity/semver_stability_grep.py +358 -0
  290. package/src/apothem/conformity/smoke_install_grep.py +194 -0
  291. package/src/apothem/conformity/static_version_grep.py +284 -0
  292. package/src/apothem/conformity/token_efficiency_grep.py +185 -0
  293. package/src/apothem/conformity/unpinned_action_grep.py +115 -0
  294. package/src/apothem/conformity/user_confirm_grep.py +74 -0
  295. package/src/apothem/conformity/workflow_concurrency_grep.py +283 -0
  296. package/src/apothem/harnesses/README.md +63 -0
  297. package/src/apothem/harnesses/__init__.py +16 -0
  298. package/src/apothem/harnesses/_shared/README.md +36 -0
  299. package/src/apothem/harnesses/_shared/__init__.py +12 -0
  300. package/src/apothem/harnesses/_shared/install_driver.py +281 -0
  301. package/src/apothem/harnesses/_shared/install_driver_apply.py +612 -0
  302. package/src/apothem/harnesses/_shared/install_driver_backup.py +535 -0
  303. package/src/apothem/harnesses/_shared/install_driver_converters.py +310 -0
  304. package/src/apothem/harnesses/_shared/install_driver_lifecycle.py +495 -0
  305. package/src/apothem/harnesses/_shared/install_driver_materialize.py +675 -0
  306. package/src/apothem/harnesses/_shared/install_driver_merge.py +656 -0
  307. package/src/apothem/harnesses/_shared/install_driver_pathsafety.py +137 -0
  308. package/src/apothem/harnesses/_shared/install_driver_planvalidation.py +240 -0
  309. package/src/apothem/harnesses/_shared/install_driver_removal.py +366 -0
  310. package/src/apothem/harnesses/_shared/install_driver_treeops.py +248 -0
  311. package/src/apothem/harnesses/_shared/install_driver_types.py +330 -0
  312. package/src/apothem/harnesses/_shared/wrapper_factories.py +448 -0
  313. package/src/apothem/harnesses/antigravity/STANDARD-CONVENTION-PIN.md +91 -0
  314. package/src/apothem/harnesses/antigravity/__init__.py +70 -0
  315. package/src/apothem/harnesses/antigravity/capabilities.yml +40 -0
  316. package/src/apothem/harnesses/antigravity/install.py +63 -0
  317. package/src/apothem/harnesses/antigravity/templates/GEMINI.md +40 -0
  318. package/src/apothem/harnesses/antigravity/templates/plugin.json +5 -0
  319. package/src/apothem/harnesses/antigravity/uninstall.py +22 -0
  320. package/src/apothem/harnesses/antigravity/update.py +10 -0
  321. package/src/apothem/harnesses/antigravity/verify.py +11 -0
  322. package/src/apothem/harnesses/claude_code/STANDARD-CONVENTION-PIN.md +65 -0
  323. package/src/apothem/harnesses/claude_code/__init__.py +107 -0
  324. package/src/apothem/harnesses/claude_code/capabilities.yml +42 -0
  325. package/src/apothem/harnesses/claude_code/install.py +147 -0
  326. package/src/apothem/harnesses/claude_code/templates/settings.json +351 -0
  327. package/src/apothem/harnesses/claude_code/uninstall.py +23 -0
  328. package/src/apothem/harnesses/claude_code/update.py +10 -0
  329. package/src/apothem/harnesses/claude_code/verify.py +11 -0
  330. package/src/apothem/harnesses/codebuddy/STANDARD-CONVENTION-PIN.md +74 -0
  331. package/src/apothem/harnesses/codebuddy/__init__.py +49 -0
  332. package/src/apothem/harnesses/codebuddy/capabilities.yml +34 -0
  333. package/src/apothem/harnesses/codebuddy/install.py +40 -0
  334. package/src/apothem/harnesses/codebuddy/templates/apothem-rules.md +37 -0
  335. package/src/apothem/harnesses/codebuddy/uninstall.py +25 -0
  336. package/src/apothem/harnesses/codebuddy/update.py +10 -0
  337. package/src/apothem/harnesses/codebuddy/verify.py +11 -0
  338. package/src/apothem/harnesses/codex/STANDARD-CONVENTION-PIN.md +79 -0
  339. package/src/apothem/harnesses/codex/__init__.py +72 -0
  340. package/src/apothem/harnesses/codex/capabilities.yml +40 -0
  341. package/src/apothem/harnesses/codex/install.py +69 -0
  342. package/src/apothem/harnesses/codex/templates/AGENTS.md +40 -0
  343. package/src/apothem/harnesses/codex/templates/hooks.json +127 -0
  344. package/src/apothem/harnesses/codex/uninstall.py +23 -0
  345. package/src/apothem/harnesses/codex/update.py +10 -0
  346. package/src/apothem/harnesses/codex/verify.py +11 -0
  347. package/src/apothem/harnesses/cursor/STANDARD-CONVENTION-PIN.md +79 -0
  348. package/src/apothem/harnesses/cursor/__init__.py +48 -0
  349. package/src/apothem/harnesses/cursor/capabilities.yml +42 -0
  350. package/src/apothem/harnesses/cursor/install.py +38 -0
  351. package/src/apothem/harnesses/cursor/templates/apothem-rules.mdc +40 -0
  352. package/src/apothem/harnesses/cursor/uninstall.py +25 -0
  353. package/src/apothem/harnesses/cursor/update.py +10 -0
  354. package/src/apothem/harnesses/cursor/verify.py +11 -0
  355. package/src/apothem/harnesses/gemini_cli/STANDARD-CONVENTION-PIN.md +102 -0
  356. package/src/apothem/harnesses/gemini_cli/__init__.py +52 -0
  357. package/src/apothem/harnesses/gemini_cli/capabilities.yml +43 -0
  358. package/src/apothem/harnesses/gemini_cli/install.py +43 -0
  359. package/src/apothem/harnesses/gemini_cli/templates/GEMINI.md +38 -0
  360. package/src/apothem/harnesses/gemini_cli/uninstall.py +25 -0
  361. package/src/apothem/harnesses/gemini_cli/update.py +10 -0
  362. package/src/apothem/harnesses/gemini_cli/verify.py +11 -0
  363. package/src/apothem/harnesses/github_copilot/STANDARD-CONVENTION-PIN.md +84 -0
  364. package/src/apothem/harnesses/github_copilot/__init__.py +47 -0
  365. package/src/apothem/harnesses/github_copilot/capabilities.yml +42 -0
  366. package/src/apothem/harnesses/github_copilot/install.py +40 -0
  367. package/src/apothem/harnesses/github_copilot/templates/copilot-instructions.md +33 -0
  368. package/src/apothem/harnesses/github_copilot/uninstall.py +25 -0
  369. package/src/apothem/harnesses/github_copilot/update.py +10 -0
  370. package/src/apothem/harnesses/github_copilot/verify.py +11 -0
  371. package/src/apothem/harnesses/glm/STANDARD-CONVENTION-PIN.md +77 -0
  372. package/src/apothem/harnesses/glm/__init__.py +56 -0
  373. package/src/apothem/harnesses/glm/capabilities.yml +33 -0
  374. package/src/apothem/harnesses/glm/install.py +45 -0
  375. package/src/apothem/harnesses/glm/templates/glm.toml +58 -0
  376. package/src/apothem/harnesses/glm/uninstall.py +25 -0
  377. package/src/apothem/harnesses/glm/update.py +10 -0
  378. package/src/apothem/harnesses/glm/verify.py +11 -0
  379. package/src/apothem/harnesses/hermes/STANDARD-CONVENTION-PIN.md +57 -0
  380. package/src/apothem/harnesses/hermes/__init__.py +33 -0
  381. package/src/apothem/harnesses/hermes/capabilities.yml +36 -0
  382. package/src/apothem/harnesses/hermes/install.py +17 -0
  383. package/src/apothem/harnesses/hermes/materializer.py +35 -0
  384. package/src/apothem/harnesses/hermes/uninstall.py +33 -0
  385. package/src/apothem/harnesses/hermes/update.py +10 -0
  386. package/src/apothem/harnesses/hermes/verify.py +11 -0
  387. package/src/apothem/harnesses/kimi_code/STANDARD-CONVENTION-PIN.md +128 -0
  388. package/src/apothem/harnesses/kimi_code/__init__.py +59 -0
  389. package/src/apothem/harnesses/kimi_code/capabilities.yml +40 -0
  390. package/src/apothem/harnesses/kimi_code/install.py +42 -0
  391. package/src/apothem/harnesses/kimi_code/templates/AGENTS.md +43 -0
  392. package/src/apothem/harnesses/kimi_code/uninstall.py +27 -0
  393. package/src/apothem/harnesses/kimi_code/update.py +10 -0
  394. package/src/apothem/harnesses/kimi_code/verify.py +11 -0
  395. package/src/apothem/harnesses/kiro/STANDARD-CONVENTION-PIN.md +77 -0
  396. package/src/apothem/harnesses/kiro/__init__.py +49 -0
  397. package/src/apothem/harnesses/kiro/capabilities.yml +36 -0
  398. package/src/apothem/harnesses/kiro/install.py +39 -0
  399. package/src/apothem/harnesses/kiro/templates/apothem-rules.md +36 -0
  400. package/src/apothem/harnesses/kiro/uninstall.py +25 -0
  401. package/src/apothem/harnesses/kiro/update.py +10 -0
  402. package/src/apothem/harnesses/kiro/verify.py +11 -0
  403. package/src/apothem/harnesses/open_claw/STANDARD-CONVENTION-PIN.md +62 -0
  404. package/src/apothem/harnesses/open_claw/__init__.py +35 -0
  405. package/src/apothem/harnesses/open_claw/capabilities.yml +35 -0
  406. package/src/apothem/harnesses/open_claw/install.py +17 -0
  407. package/src/apothem/harnesses/open_claw/materializer.py +36 -0
  408. package/src/apothem/harnesses/open_claw/uninstall.py +32 -0
  409. package/src/apothem/harnesses/open_claw/update.py +10 -0
  410. package/src/apothem/harnesses/open_claw/verify.py +11 -0
  411. package/src/apothem/harnesses/opencode/STANDARD-CONVENTION-PIN.md +76 -0
  412. package/src/apothem/harnesses/opencode/__init__.py +35 -0
  413. package/src/apothem/harnesses/opencode/capabilities.yml +43 -0
  414. package/src/apothem/harnesses/opencode/install.py +17 -0
  415. package/src/apothem/harnesses/opencode/materializer.py +31 -0
  416. package/src/apothem/harnesses/opencode/uninstall.py +34 -0
  417. package/src/apothem/harnesses/opencode/update.py +10 -0
  418. package/src/apothem/harnesses/opencode/verify.py +11 -0
  419. package/src/apothem/harnesses/qwen_code/STANDARD-CONVENTION-PIN.md +87 -0
  420. package/src/apothem/harnesses/qwen_code/__init__.py +37 -0
  421. package/src/apothem/harnesses/qwen_code/capabilities.yml +43 -0
  422. package/src/apothem/harnesses/qwen_code/install.py +19 -0
  423. package/src/apothem/harnesses/qwen_code/materializer.py +174 -0
  424. package/src/apothem/harnesses/qwen_code/templates/QWEN.md +30 -0
  425. package/src/apothem/harnesses/qwen_code/uninstall.py +34 -0
  426. package/src/apothem/harnesses/qwen_code/update.py +10 -0
  427. package/src/apothem/harnesses/qwen_code/verify.py +11 -0
  428. package/src/apothem/harnesses/trae/STANDARD-CONVENTION-PIN.md +70 -0
  429. package/src/apothem/harnesses/trae/__init__.py +49 -0
  430. package/src/apothem/harnesses/trae/capabilities.yml +34 -0
  431. package/src/apothem/harnesses/trae/install.py +38 -0
  432. package/src/apothem/harnesses/trae/templates/apothem-rules.md +37 -0
  433. package/src/apothem/harnesses/trae/uninstall.py +25 -0
  434. package/src/apothem/harnesses/trae/update.py +10 -0
  435. package/src/apothem/harnesses/trae/verify.py +11 -0
  436. package/src/apothem/harnesses/windsurf/STANDARD-CONVENTION-PIN.md +91 -0
  437. package/src/apothem/harnesses/windsurf/__init__.py +52 -0
  438. package/src/apothem/harnesses/windsurf/capabilities.yml +40 -0
  439. package/src/apothem/harnesses/windsurf/install.py +41 -0
  440. package/src/apothem/harnesses/windsurf/templates/apothem-rules.md +37 -0
  441. package/src/apothem/harnesses/windsurf/uninstall.py +25 -0
  442. package/src/apothem/harnesses/windsurf/update.py +10 -0
  443. package/src/apothem/harnesses/windsurf/verify.py +11 -0
  444. package/src/apothem/harnesses/zed/STANDARD-CONVENTION-PIN.md +92 -0
  445. package/src/apothem/harnesses/zed/__init__.py +57 -0
  446. package/src/apothem/harnesses/zed/capabilities.yml +38 -0
  447. package/src/apothem/harnesses/zed/install.py +41 -0
  448. package/src/apothem/harnesses/zed/templates/apothem-rules.md +32 -0
  449. package/src/apothem/harnesses/zed/uninstall.py +28 -0
  450. package/src/apothem/harnesses/zed/update.py +10 -0
  451. package/src/apothem/harnesses/zed/verify.py +11 -0
  452. package/src/apothem/hooks/README.md +81 -0
  453. package/src/apothem/hooks/__init__.py +24 -0
  454. package/src/apothem/hooks/askuserquestion_validator.py +380 -0
  455. package/src/apothem/hooks/dispatch.py +296 -0
  456. package/src/apothem/hooks/emit_hook_context.py +444 -0
  457. package/src/apothem/hooks/hooks.json +318 -0
  458. package/src/apothem/hooks/lib/README.md +39 -0
  459. package/src/apothem/hooks/lib/__init__.py +18 -0
  460. package/src/apothem/hooks/lib/bootstrap.ps1 +129 -0
  461. package/src/apothem/hooks/lib/bootstrap.sh +103 -0
  462. package/src/apothem/hooks/lib/events.py +51 -0
  463. package/src/apothem/hooks/lib/find-pwsh.ps1 +78 -0
  464. package/src/apothem/hooks/lib/find-pwsh.sh +76 -0
  465. package/src/apothem/hooks/lib/find-python.ps1 +63 -0
  466. package/src/apothem/hooks/lib/find-python.sh +97 -0
  467. package/src/apothem/hooks/lib/log.py +43 -0
  468. package/src/apothem/hooks/lib/resolve_root.py +264 -0
  469. package/src/apothem/hooks/messages/postcompact.md +14 -0
  470. package/src/apothem/hooks/messages/posttooluse-proactive-compaction.md +46 -0
  471. package/src/apothem/hooks/messages/precompact.md +14 -0
  472. package/src/apothem/hooks/messages/pretooluse-askuserquestion-recommended.md +65 -0
  473. package/src/apothem/hooks/messages/pretooluse-bash-plan-guard.md +97 -0
  474. package/src/apothem/hooks/messages/pretooluse-bash.md +39 -0
  475. package/src/apothem/hooks/messages/pretooluse-conformity.md +70 -0
  476. package/src/apothem/hooks/messages/pretooluse-dependency-guard.md +21 -0
  477. package/src/apothem/hooks/messages/pretooluse-edit-header-guard.md +61 -0
  478. package/src/apothem/hooks/messages/pretooluse-edit.md +21 -0
  479. package/src/apothem/hooks/messages/pretooluse-eval-guard.md +39 -0
  480. package/src/apothem/hooks/messages/pretooluse-notebookedit.md +11 -0
  481. package/src/apothem/hooks/messages/pretooluse-write-header-guard.md +45 -0
  482. package/src/apothem/hooks/messages/pretooluse-write-plan-guard.md +72 -0
  483. package/src/apothem/hooks/messages/pretooluse-write.md +21 -0
  484. package/src/apothem/hooks/messages/sessionstart.md +15 -0
  485. package/src/apothem/hooks/messages/stop.md +27 -0
  486. package/src/apothem/hooks/proactive_compaction_tracker.py +327 -0
  487. package/src/apothem/hooks/session_start_bootstrap.py +472 -0
  488. package/src/apothem/lib/README.md +42 -0
  489. package/src/apothem/lib/__init__.py +13 -0
  490. package/src/apothem/lib/atomic_io.py +189 -0
  491. package/src/apothem/lib/auditor.py +687 -0
  492. package/src/apothem/lib/clean_slate.py +396 -0
  493. package/src/apothem/lib/contexts.py +352 -0
  494. package/src/apothem/lib/data_home.py +255 -0
  495. package/src/apothem/lib/frontmatter.py +101 -0
  496. package/src/apothem/lib/harness_materializer.py +213 -0
  497. package/src/apothem/lib/harness_protocol.py +59 -0
  498. package/src/apothem/lib/harness_registry.py +282 -0
  499. package/src/apothem/lib/harness_registry_data.py +843 -0
  500. package/src/apothem/lib/install_ledger.py +347 -0
  501. package/src/apothem/lib/learning.py +540 -0
  502. package/src/apothem/lib/memory.py +347 -0
  503. package/src/apothem/lib/parallel_sweep.py +234 -0
  504. package/src/apothem/lib/plan_tiers.py +200 -0
  505. package/src/apothem/lib/plugin_bootstrap.py +132 -0
  506. package/src/apothem/lib/plugin_tree.py +599 -0
  507. package/src/apothem/lib/profile.py +755 -0
  508. package/src/apothem/lib/profile_projection.py +198 -0
  509. package/src/apothem/lib/propagation-manifest.yaml +878 -0
  510. package/src/apothem/lib/propagation.py +220 -0
  511. package/src/apothem/lib/python_resolver.py +189 -0
  512. package/src/apothem/lib/reporter.py +62 -0
  513. package/src/apothem/lib/workspace_migration.py +323 -0
  514. package/src/apothem/output-styles/README.md +41 -0
  515. package/src/apothem/output-styles/concise-engineer.md +49 -0
  516. package/src/apothem/output-styles/default-architect.md +52 -0
  517. package/src/apothem/output-styles/default.md +113 -0
  518. package/src/apothem/output-styles/forensic-auditor.md +63 -0
  519. package/src/apothem/py.typed +0 -0
  520. package/src/apothem/rules/README.md +121 -0
  521. package/src/apothem/rules/agent-capability-discipline-matrix.md +89 -0
  522. package/src/apothem/rules/agent-capability-discipline.md +78 -0
  523. package/src/apothem/rules/agent-orchestration-patterns.md +144 -0
  524. package/src/apothem/rules/agent-orchestration.md +65 -0
  525. package/src/apothem/rules/agents-md-convention.md +86 -0
  526. package/src/apothem/rules/agile-sprints-elements.md +135 -0
  527. package/src/apothem/rules/agile-sprints.md +64 -0
  528. package/src/apothem/rules/agnostic-posture-checklist.md +47 -0
  529. package/src/apothem/rules/agnostic-posture.md +48 -0
  530. package/src/apothem/rules/authoritative-referencing-quotation.md +50 -0
  531. package/src/apothem/rules/authoritative-referencing.md +66 -0
  532. package/src/apothem/rules/authority-inquiry-categories.md +58 -0
  533. package/src/apothem/rules/authority-inquiry.md +54 -0
  534. package/src/apothem/rules/auto-memory-topic-files.md +86 -0
  535. package/src/apothem/rules/auto-memory.md +67 -0
  536. package/src/apothem/rules/bidirectional-binding.md +123 -0
  537. package/src/apothem/rules/canonical-layout-reporting-tiers.md +212 -0
  538. package/src/apothem/rules/canonical-layout.md +60 -0
  539. package/src/apothem/rules/clean-architecture-layers.md +186 -0
  540. package/src/apothem/rules/clean-room-generation-protocols.md +124 -0
  541. package/src/apothem/rules/clean-room-generation.md +59 -0
  542. package/src/apothem/rules/code-craft-conventions.md +101 -0
  543. package/src/apothem/rules/code-craft-markdown.md +138 -0
  544. package/src/apothem/rules/code-craft-python.md +154 -0
  545. package/src/apothem/rules/code-craft-shell.md +192 -0
  546. package/src/apothem/rules/cognitive-identity-techniques.md +180 -0
  547. package/src/apothem/rules/cognitive-identity.md +81 -0
  548. package/src/apothem/rules/context-management-budget.md +46 -0
  549. package/src/apothem/rules/context-management-protocol.md +161 -0
  550. package/src/apothem/rules/context-management-scratch.md +128 -0
  551. package/src/apothem/rules/context-management.md +85 -0
  552. package/src/apothem/rules/definitiveness-virtues.md +67 -0
  553. package/src/apothem/rules/definitiveness.md +58 -0
  554. package/src/apothem/rules/determinism.md +81 -0
  555. package/src/apothem/rules/disclosure-ledger-markers.md +58 -0
  556. package/src/apothem/rules/disclosure-ledger.md +52 -0
  557. package/src/apothem/rules/dynamism.md +38 -0
  558. package/src/apothem/rules/etc-extension.md +57 -0
  559. package/src/apothem/rules/expertise-posture-elements.md +68 -0
  560. package/src/apothem/rules/expertise-posture.md +54 -0
  561. package/src/apothem/rules/freshness-facade.md +64 -0
  562. package/src/apothem/rules/harness-adapter-shape-schemas.md +162 -0
  563. package/src/apothem/rules/harness-adapter-shape.md +42 -0
  564. package/src/apothem/rules/host-discovery-manifests.md +50 -0
  565. package/src/apothem/rules/host-discovery.md +56 -0
  566. package/src/apothem/rules/i18n-discipline-locale-cohorts.md +120 -0
  567. package/src/apothem/rules/i18n-discipline.md +70 -0
  568. package/src/apothem/rules/interactive-questions-canonical-shapes.md +590 -0
  569. package/src/apothem/rules/interactive-questions-detail.md +41 -0
  570. package/src/apothem/rules/interactive-questions-sweep-matchers.md +184 -0
  571. package/src/apothem/rules/interactive-questions.md +89 -0
  572. package/src/apothem/rules/large-file-generation.md +112 -0
  573. package/src/apothem/rules/large-file-reading.md +59 -0
  574. package/src/apothem/rules/living-docs.md +85 -0
  575. package/src/apothem/rules/multi-agent-workflow.md +57 -0
  576. package/src/apothem/rules/operational-mandates-expanded.md +78 -0
  577. package/src/apothem/rules/operational-mandates.md +88 -0
  578. package/src/apothem/rules/option-annotation-form.md +60 -0
  579. package/src/apothem/rules/option-annotation.md +45 -0
  580. package/src/apothem/rules/own-voice-reimplementation.md +86 -0
  581. package/src/apothem/rules/performance-discipline.md +91 -0
  582. package/src/apothem/rules/persistent-conventions-vigilance-checklist.md +54 -0
  583. package/src/apothem/rules/persistent-conventions-vigilance.md +61 -0
  584. package/src/apothem/rules/plain-language.md +56 -0
  585. package/src/apothem/rules/planning-techniques.md +130 -0
  586. package/src/apothem/rules/pre-emission-gate-bars.md +86 -0
  587. package/src/apothem/rules/pre-emission-gate.md +54 -0
  588. package/src/apothem/rules/production-ready-prs-surfaces.md +162 -0
  589. package/src/apothem/rules/production-ready-prs.md +83 -0
  590. package/src/apothem/rules/propagation.md +63 -0
  591. package/src/apothem/rules/recommend-next-step.md +106 -0
  592. package/src/apothem/rules/refactoring-discipline.md +76 -0
  593. package/src/apothem/rules/session-closure.md +44 -0
  594. package/src/apothem/rules/sota-elevation-exemplars.md +76 -0
  595. package/src/apothem/rules/sota-elevation.md +52 -0
  596. package/src/apothem/rules/source-accessibility.md +58 -0
  597. package/src/apothem/rules/surgical-manipulation.md +48 -0
  598. package/src/apothem/rules/systemic-participation-relations.md +108 -0
  599. package/src/apothem/rules/systemic-participation.md +70 -0
  600. package/src/apothem/rules/ten-dimension-check-dimensions.md +52 -0
  601. package/src/apothem/rules/ten-dimension-check.md +59 -0
  602. package/src/apothem/rules/token-budget-discipline.md +81 -0
  603. package/src/apothem/rules/token-efficiency-rewrite-protocol.md +79 -0
  604. package/src/apothem/rules/token-efficiency-rewrite.md +77 -0
  605. package/src/apothem/rules/tool-use-discipline.md +48 -0
  606. package/src/apothem/rules/visual-leverage.md +102 -0
  607. package/src/apothem/schemas/NOTICE.md +9 -0
  608. package/src/apothem/schemas/README.md +104 -0
  609. package/src/apothem/schemas/__init__.py +176 -0
  610. package/src/apothem/schemas/advisory-finding.schema.json +111 -0
  611. package/src/apothem/schemas/agent.schema.json +106 -0
  612. package/src/apothem/schemas/authorship-header.txt +1 -0
  613. package/src/apothem/schemas/cohort-manifest.yaml +248 -0
  614. package/src/apothem/schemas/cohort-metadata-vocabulary.yaml +168 -0
  615. package/src/apothem/schemas/cohort.schema.json +113 -0
  616. package/src/apothem/schemas/command.schema.json +68 -0
  617. package/src/apothem/schemas/compatibility-matrix.yaml +432 -0
  618. package/src/apothem/schemas/context-fragment.schema.json +64 -0
  619. package/src/apothem/schemas/freshness-token-denylist.txt +51 -0
  620. package/src/apothem/schemas/handoff-manifest.yaml +353 -0
  621. package/src/apothem/schemas/header-exceptions.txt +141 -0
  622. package/src/apothem/schemas/header-visibility.yaml +39 -0
  623. package/src/apothem/schemas/learning-signal.schema.json +46 -0
  624. package/src/apothem/schemas/memory-record.schema.json +61 -0
  625. package/src/apothem/schemas/output-style.schema.json +40 -0
  626. package/src/apothem/schemas/plan.schema.json +51 -0
  627. package/src/apothem/schemas/plugin.schema.json +83 -0
  628. package/src/apothem/schemas/profile.example.yaml +70 -0
  629. package/src/apothem/schemas/profile.minimal.yaml +6 -0
  630. package/src/apothem/schemas/profile.schema.json +396 -0
  631. package/src/apothem/schemas/reference-token-denylist.txt +25 -0
  632. package/src/apothem/schemas/skill.schema.json +75 -0
  633. package/src/apothem/skills/README.md +93 -0
  634. package/src/apothem/skills/dependency-upgrade/SKILL.md +105 -0
  635. package/src/apothem/skills/dev-toolkit/SKILL.md +120 -0
  636. package/src/apothem/skills/diagram-authoring/SKILL.md +113 -0
  637. package/src/apothem/skills/document-authoring/SKILL.md +118 -0
  638. package/src/apothem/skills/ecosystem-audit/SKILL.md +108 -0
  639. package/src/apothem/skills/ecosystem-audit/references/audit-fortress.md +85 -0
  640. package/src/apothem/skills/ecosystem-audit/references/procedure.md +162 -0
  641. package/src/apothem/skills/eval-harness/SKILL.md +88 -0
  642. package/src/apothem/skills/incident-runbook/SKILL.md +92 -0
  643. package/src/apothem/skills/multi-source-research/SKILL.md +90 -0
  644. package/src/apothem/skills/plan-suite/SKILL.md +118 -0
  645. package/src/apothem/skills/plan-suite/master_template.md +1324 -0
  646. package/src/apothem/skills/projectify/SKILL.md +117 -0
  647. package/src/apothem/skills/prompt-engineering/SKILL.md +122 -0
  648. package/src/apothem/skills/refactor-extract/SKILL.md +85 -0
  649. package/src/apothem/skills/research-suite/SKILL.md +170 -0
  650. package/src/apothem/skills/research-suite/references/directory-structure.md +47 -0
  651. package/src/apothem/skills/research-suite/references/lifecycle.md +67 -0
  652. package/src/apothem/skills/research-suite/references/principal-investigator-framework.md +37 -0
  653. package/src/apothem/skills/research-suite/references/rigor-mandates.md +30 -0
  654. package/src/apothem/skills/research-suite/research_template.md +476 -0
  655. package/src/apothem/skills/secret-rotation/SKILL.md +87 -0
  656. package/src/apothem/skills/source-synthesis/SKILL.md +92 -0
  657. package/src/apothem/skills/surgical-guard/SKILL.md +118 -0
  658. package/src/apothem/skills/test-authoring/SKILL.md +85 -0
  659. package/src/apothem/skills/vuln-triage/SKILL.md +91 -0
  660. package/src/apothem/skills/workflow/SKILL.md +139 -0
  661. package/src/apothem/statuslines/README.md +26 -0
  662. package/src/apothem/statuslines/__init__.py +20 -0
  663. package/src/apothem/statuslines/conformity.json +5 -0
  664. package/src/apothem/statuslines/render.py +334 -0
  665. package/src/apothem/statuslines/statusline.md +50 -0
  666. package/src/apothem/templates/README.md +43 -0
  667. package/src/apothem/templates/agents-md-template.md +80 -0
  668. package/src/apothem/templates/consideration-log.md +39 -0
  669. package/src/apothem/templates/expertise-gap-log.md +56 -0
  670. package/src/apothem/templates/master-index-template.md +93 -0
  671. package/src/apothem/templates/potency-map.md +53 -0
  672. package/src/apothem/templates/preservation-audit.md +60 -0
  673. package/src/apothem/templates/question-resolution-audit.md +52 -0
  674. package/src/apothem/templates/trace-matrix-template.md +77 -0
@@ -0,0 +1,121 @@
1
+ <!-- SPDX-License-Identifier: MIT -->
2
+
3
+ # Rules
4
+
5
+ Behavioral instruction rules — flat `.md` files, each a self-contained directive set the harness loads to govern agent behavior. Each carries YAML frontmatter declaring `name`, `description`, `pathFilter`, and `alwaysApply`; a body of obligations; and a `## Bindings` section wiring it to its peers.
6
+
7
+ ## Always-on vs path-filtered rules
8
+
9
+ Every rule is one of two kinds, declared in frontmatter:
10
+
11
+ - **Always-on** — `alwaysApply: true` with an empty `pathFilter:`. Loaded into every session. To keep the always-on tier lean, each always-on body is capped at 500 substantive tokens per `token-budget-discipline.md`.
12
+ - **Path-filtered (companion)** — `alwaysApply: false` with a `pathFilter:` glob list. Demand-loaded only when the agent touches a matching artifact.
13
+
14
+ ## The parent / companion-sub-rule pattern
15
+
16
+ When an always-on rule's content exceeds the token ceiling, it decomposes along a path-filtered seam: the **parent** rule retains the standing directive plus a one-line summary and a `(Companion Sub-Rule Anchor)` pointer; the **companion** sibling — named `<parent>-<aspect>.md`, path-filtered — carries the operational depth (catalogs, worked examples, executable matchers, full tables). The companion demand-loads only when relevant, so detail pays its context cost only where it applies. Pairs are reciprocally cited in each rule's `## Bindings` block.
17
+
18
+ ## The `## Bindings` five-direction section
19
+
20
+ Every rule closes with a `## Bindings (§0.j five-direction)` section declaring its place in the rule graph along five reciprocal directions: **Drives →** (what it causes), **Driven by ← / Established by ↑** (what gates / ratifies it), **Satisfies →** (what end-state it meets), and **Cross-bound with ↔** (sibling rules that mutually reinforce). Every declared binding has a reciprocal back-pointer at the other end; the discipline is specified in `bidirectional-binding.md`.
21
+
22
+ ## Rule families
23
+
24
+ ### Cognitive identity & generation methodology
25
+
26
+ | Rule | Concern |
27
+ |------|---------|
28
+ | `cognitive-identity.md` · `cognitive-identity-techniques.md` | The cognitive-insurgent identity — five creative filters, six ideation techniques, language standards, seven-axs-of-breadth taxonomy. |
29
+ | `clean-room-generation.md` · `clean-room-generation-protocols.md` | Specification-derived original output — Writing / Re-Writing protocols, code-generation discipline. |
30
+ | `planning-techniques.md` | Nine planning review techniques for plan generation, review, execution. |
31
+
32
+ ### Operational mandates & quality gates
33
+
34
+ | Rule | Concern |
35
+ |------|---------|
36
+ | `agnostic-posture.md` · `agnostic-posture-checklist.md` | Default-off, opt-in posture for every shipped behavior; correctness gates stay advisory; harness-neutral surfaces; model / effort / workflow preference is end-user-invoked — plus the per-invariant verification checklist every phase's definition of done satisfies. |
37
+ | `agents-md-convention.md` | The root `AGENTS.md` is the single agent-facing canon; per-folder operating guidance lives in each folder's `README.md` (one file, both the human and agent reader); per-folder `AGENTS.md` companions are not required, and any present companion stays current and canon-coherent with the root AI-surface canon. |
38
+ | `operational-mandates.md` · `operational-mandates-expanded.md` | Operational mandates CM-1–CM-10 — critical evaluation, zero assumptions, search-before-implement, brutal honesty. |
39
+ | `pre-emission-gate.md` · `pre-emission-gate-bars.md` | The fifteen-bar pre-emission gate (M1–M15) every artifact passes before emission, with a recorded attestation. |
40
+ | `ten-dimension-check.md` · `ten-dimension-check-dimensions.md` | The ten quality dimensions applied to every artifact (M3). |
41
+ | `definitiveness.md` · `definitiveness-virtues.md` | Definitive, airtight statements; hedging elimination; the rigorous-systems virtues (M8). |
42
+ | `etc-extension.md` | Enumerations are seeds, not ceilings — every open-set marker (`etc.` / `e.g.` / `such as` / `like` / `including` / `…`) is a directive to extend comprehensively from intent; an explicitly-closed enumeration is exempt. |
43
+ | `source-accessibility.md` | Source trust outranks accessibility — reach a trusted-but-inaccessible source via browser then operator interview; never prefer untrusted-but-free over trusted-but-inaccessible; record the source-trust decision. |
44
+ | `authoritative-referencing.md` · `authoritative-referencing-quotation.md` | Every claim / argument / hypothesis / fact cites an authoritative, official, current source — the scattered dim-9 / sota named-exemplar / disclosure-ledger / output-style-citation discipline consolidated by reference; folklore and "industry standard" appeals are non-conformant. The path-filtered companion binds the reproduction form: paraphrase by default with attribution, quote sparingly and briefly, never reproduce a full third-party work, attribute without a legal opinion. |
45
+ | `dynamism.md` | No static substitutions for dynamic-source-of-truth values — version / badge / release / docs-version / runtime `__version__` / social-card stamps render from one live authority; the `static-version-grep` matcher enforces the closed surface set. |
46
+ | `sota-elevation.md` · `sota-elevation-exemplars.md` | State-of-the-art elevation as the default posture for OSS-distribution surfaces — eight SOTA evaluation surfaces, named-exemplar discipline, MAXIMAL upper-bound calibration. |
47
+
48
+ ### Host-project conduct (the M-mandate family)
49
+
50
+ | Rule | Concern |
51
+ |------|---------|
52
+ | `host-discovery.md` · `host-discovery-manifests.md` | Discover and honor host-project conventions before emitting (M1). |
53
+ | `disclosure-ledger.md` · `disclosure-ledger-markers.md` | Disclosed amendments, never silent — the change ledger (M2). |
54
+ | `authority-inquiry.md` · `authority-inquiry-categories.md` | Inquire, do not invent — names, endpoints, scope, version pins (M5). |
55
+ | `expertise-posture.md` · `expertise-posture-elements.md` | Read intent, amend proactively, surface gaps (M6). |
56
+ | `option-annotation.md` · `option-annotation-form.md` | Every multi-option choice carries a Recommended marker plus rationale (M7). |
57
+ | `visual-leverage.md` | Diagrams where structure is the subject (M9). |
58
+ | `bidirectional-binding.md` | Reciprocal five-direction bindings; phase-execution threading (M10). |
59
+ | `agile-sprints.md` · `agile-sprints-elements.md` | Non-trivial multi-step work runs as disciplined Agile sprints (M11). |
60
+ | `canonical-layout.md` · `canonical-layout-reporting-tiers.md` | Two-tier phase reporting; canonical output layout; orphan prevention (M12). |
61
+ | `systemic-participation.md` · `systemic-participation-relations.md` | Artifacts join the host as systemic participants — no orphans, no silos (M14). |
62
+ | `production-ready-prs.md` · `production-ready-prs-surfaces.md` | Every change ships production-ready — tests, docs, CHANGELOG, CI green (M15). |
63
+ | `own-voice-reimplementation.md` | Reference-derived features reauthored in apothem's own voice — zero verbatim copy, mandatory elevation, harness-doc-aligned. |
64
+ | `living-docs.md` | Every change to a documented public surface updates its docs page in the same change-set — the documentation analogue of the production-ready discipline; CI's docs-reference-sync drift gate enforces it. |
65
+ | `freshness-facade.md` | Shipped public surfaces stay a current-version-only facade — no AI-disclosure, backward / legacy / placeholder, or fix-and-refinement narrative; the `freshness-token-grep` matcher gives the closed token-class list mechanical teeth on README plus site copy. |
66
+ | `surgical-manipulation.md` | Surgical, anchor-bounded, minimal-diff mutation discipline — scoped edits over blunt whole-file overwrites across every file class; paired with the `surgical-guard` skill's post-edit quality pass. |
67
+ | `propagation.md` | Full-reference-graph propagation — every mutation propagates same-change-set across code / docs / tests / examples / registries / plugins / bindings; generalizes `living-docs.md` + `systemic-participation.md` and binds the existing drift gates (the CM-8 keystone). |
68
+ | `refactoring-discipline.md` | Agent-driven refactoring is test-gated (green before AND after), one concern at a time, plan-first, and continuous — the workflow / cadence discipline that gates the clean-room re-writing protocol for a refactor. |
69
+ | `harness-adapter-shape.md` · `harness-adapter-shape-schemas.md` | Every adapter in the 17-harness cohort performs host discovery, converges on the sibling adapter shape, declares divergences, carries the adapter-test matrix, and ships a co-resident STANDARD-CONVENTION-PIN. |
70
+ | `i18n-discipline.md` · `i18n-discipline-locale-cohorts.md` | Translated surfaces ship in every Modern-Dev-Cohort locale or surface the gap — framework i18n integration, machine-seed + human-review gate, per-locale glossary, RTL + hreflang discipline. |
71
+ | `plain-language.md` | User-facing narrative free of process-tooling leak — AI / harness / plan-stage / process vocabulary stays out of README / docs / site copy; the `plain-language-grep` matcher enforces the closed set with domain carve-outs. |
72
+
73
+ ### Code craft (M13, per language)
74
+
75
+ | Rule | Concern |
76
+ |------|---------|
77
+ | `code-craft-conventions.md` | Universal code-craft delegation stub for languages without a dedicated rule. |
78
+ | `code-craft-python.md` | Python — SOLID, modern type hints, Google-style docstrings, pytest, security guardrails. |
79
+ | `code-craft-shell.md` | Shell — POSIX bash + PowerShell idioms, strict mode, injection prevention. |
80
+ | `code-craft-markdown.md` | Markdown / prose — purpose-driven structure, sentence-level justification, active voice. |
81
+ | `clean-architecture-layers.md` | Domain / Application / Infrastructure / Presentation layer discipline. |
82
+
83
+ ### Context, memory & conventions
84
+
85
+ | Rule | Concern |
86
+ |------|---------|
87
+ | `context-management.md` · `context-management-protocol.md` · `context-management-scratch.md` · `context-management-budget.md` | Context-rot mitigation, blind-execution protocol, externalization, plan-workflow scratch convention, per-task effort calibration + context-budget discipline. |
88
+ | `auto-memory.md` · `auto-memory-topic-files.md` | Auto-memory lifecycle — topic files, MEMORY.md index, promotion ledger. |
89
+ | `persistent-conventions-vigilance.md` · `persistent-conventions-vigilance-checklist.md` | Ecosystem-convention adherence and proactive artifact evolution (CM-22). |
90
+ | `large-file-generation.md` | Large file generation via incremental appends (CM-23). |
91
+ | `token-budget-discipline.md` | The 500-token ceiling on always-on rule bodies. |
92
+ | `large-file-reading.md` | Size-aware file reading — pre-read assessment, locate-before-read, structural traversal, segmentation; the read-side analogue of `large-file-generation.md`. |
93
+ | `token-efficiency-rewrite.md` · `token-efficiency-rewrite-protocol.md` | Token-efficiency as a rewrite discipline — preserve L2 semantic content + L3 structural anchors, discard L1 scaffolding; pairs with `token-budget-discipline.md` (caps) to fit the always-on ceiling. |
94
+
95
+ ### Agent orchestration & interaction
96
+
97
+ | Rule | Concern |
98
+ |------|---------|
99
+ | `agent-orchestration.md` · `agent-orchestration-patterns.md` | Agent / agent-team deployment patterns, return contracts, context isolation. |
100
+ | `agent-capability-discipline.md` · `agent-capability-discipline-matrix.md` | Per-harness agentic-capability matrix across the 17-harness cohort — MCP support, sub-agent dispatch, tool-surface restriction, agent-memory convention, output-style / custom-command / hooks / skills surfaces. |
101
+ | `multi-agent-workflow.md` | Independent-critique / open-loop / dynamic multi-agent execution as an available, specified capability — opt-in and default-off under the agnostic posture; orchestration mechanics owned by `agent-orchestration.md`. |
102
+ | `tool-use-discipline.md` | Ordinary tool use as a disciplined loop — independent calls batched in one turn (the ordinary-tool-tier generalization of the agent-tier single-message parallel-launch), the observe → decide → act cadence named, and iteration to a verifiable exit rather than a fixed count. |
103
+ | `interactive-questions.md` · `interactive-questions-canonical-shapes.md` · `interactive-questions-sweep-matchers.md` · `interactive-questions-detail.md` | The structured-inquiry channel — Structured-Inquiry Shape, option annotation, sweep matchers, authoring discipline + anti-patterns. |
104
+ | `determinism.md` · `recommend-next-step.md` | Deterministic output shape across command and skill surfaces; the `(Recommended)`-in-header invariant; every terminal surface closes with a definitive named next step. |
105
+ | `session-closure.md` | Every session — ad-hoc conversational sessions included, not only plan phases — ends with a formal, verifiable close: a terminal Recommended Next Step, a done/deferred ledger, and a verification attestation; harness-agnostic. |
106
+ | `performance-discipline.md` | Per-class performance budgets and quantitative gates. |
107
+
108
+ ## Conventions
109
+
110
+ - One flat `.md` file per rule; kebab-case filenames; companion files suffix the parent name with the aspect.
111
+ - Every file carries the canonical single-line SPDX license header and a non-empty `description` frontmatter field.
112
+ - Cross-references between rules use relative paths and are reciprocal in the `## Bindings` section.
113
+
114
+ ## Operating in this folder
115
+
116
+ - **File shape.** YAML frontmatter (`name`, `description`, `pathFilter`, `alwaysApply`) → the single-line SPDX license header (HTML-comment form) → the obligations body → a closing `## Bindings (§0.j five-direction)` section. The frontmatter `description` field MUST be populated; the PreToolUse frontmatter check rejects an empty one.
117
+ - **Token budget.** An always-on body (`alwaysApply: true`, empty `pathFilter`) is capped at 500 substantive tokens per `token-budget-discipline.md`; over-budget content decomposes into a path-filtered companion rather than inflating the parent.
118
+ - **Reciprocal bindings.** Every `## Bindings` cross-reference has a matching back-pointer at the cited peer; half-edges fail the bindings-reciprocity gate.
119
+ - **Harness-neutral prose.** This folder is swept by the agnosticism and reference-token matchers. Name a harness only by its catalog slug — one entry among the registered set — never by a privileging brand phrase, and pre-set no model or effort preference.
120
+ - **Adding a rule:** author the file with the shape above, add its row to the registry table above, and wire it into the rule graph via its `## Bindings` section; decide always-on vs companion by the token budget. **Splitting an over-budget always-on rule:** move depth to a `<parent>-<aspect>.md` companion, leave the `(Companion Sub-Rule Anchor)` pointer in the parent, and make both `## Bindings` blocks cite each other.
121
+ - Validate every change with `python -m apothem.conformity.gate --all .` (frontmatter, token-budget, bindings-reciprocity, agnosticism, reference-token matchers) and `python -m pytest`.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: "agent-capability-discipline-matrix"
3
+ description: "Path-filtered companion to `agent-capability-discipline.md` — carries the per-harness agentic-capability matrix (§1), the per-harness MCP-surface catalog (§3), and the per-harness agent-memory-convention catalog (§7) the parent rule's anchors delegate to. Demand-loaded when the assistant edits any adapter sub-package, cross-harness capability-matrix input, or per-harness MCP-config artifact."
4
+ pathFilter: "**/src/apothem/harnesses/**, **/_inputs/cross-harness-agent-capability-matrix.md, **/.mcp.json, **/mcp.json"
5
+ alwaysApply: false
6
+ ---
7
+
8
+ <!-- SPDX-License-Identifier: MIT -->
9
+
10
+ # Rule: Agent Capability Discipline — Per-Harness Matrix (Companion Sub-Rule)
11
+
12
+ ## Purpose
13
+
14
+ Carry the per-harness agentic-capability matrix, the per-harness MCP-surface catalog, and the per-harness agent-memory-convention catalog that the parent `rules/agent-capability-discipline.md` rule's §1 / §3 / §7 anchors delegate to. Path-filtered: loads when the assistant edits adapter sub-packages under `src/apothem/harnesses/<name>/`, the cross-harness capability-matrix scratch input under `_inputs/cross-harness-agent-capability-matrix.md`, or per-harness MCP-config artifacts (`.mcp.json`, `mcp.json`). The parent rule retains the standing directive, the plain-language boundary, the disclosure surface, the failure tells, and the bindings; this companion carries the per-harness operational catalogs.
15
+
16
+ ## Obligations
17
+
18
+ ### 1. Per-Harness Agentic-Capability Matrix
19
+
20
+ Every cell is one of: **yes** (vendor-supported per the adapter's pinned snapshot), **no** (vendor does not support), **partial** (vendor supports a subset; the adapter's STANDARD CONVENTION PIN names the subset boundary), **discovery-pending** (the capability has not yet been discovered against the harness's pinned snapshot; surfaces as a finding per the disclosure ledger).
21
+
22
+ The matrix axes:
23
+
24
+ - **Rows (17 harnesses):** antigravity, claude_code, codebuddy, codex, cursor, gemini_cli, github_copilot, hermes, kimi_code, kiro, open_claw, opencode, qwen_code, trae, windsurf, zed, glm.
25
+ - **Core columns (9 capabilities):** MCP server support · sub-agent dispatch · tool-surface restrictions · system-prompt template surface · agent-memory convention · output-style support · custom-command support · hooks-pipeline support · skills-directory support.
26
+ - **Supplemental operational columns:** recommended-postfix rendering · long-context/compaction continuity · context-ignore surface · layered-context surface · LSP/symbol-navigation surface · hook-learning capture surface · standard-convention pin pointer · web-fetch / browser-retrieval surface (the `web_fetch` projection backing `rules/source-accessibility.md` step 1's "retrieve through the host's browser / fetch capability" escalation).
27
+
28
+ Each row's authoritative cell values live co-resident with the adapter's STANDARD CONVENTION PIN at `src/apothem/harnesses/<name>/STANDARD-CONVENTION-PIN.md` per `rules/harness-adapter-shape.md` §6. Until every adapter pin carries the full evidence chain, `src/apothem/harnesses/<name>/capabilities.yml` is the interim machine-readable projection for installed checks; it carries the legacy five required fields plus `custom_command_support`, `recommended_postfix_rendering`, `long_context_compaction`, `context_ignore_surface`, `layered_context_surface`, `lsp_symbol_navigation`, `hook_learning_capture`, `standard_convention_pin`, and `web_fetch` (the web-fetch / browser-retrieval surface per §1A). The aggregate cross-harness matrix is materialized at `_inputs/cross-harness-agent-capability-matrix.md` during the cross-harness convergence walks.
29
+
30
+ Per-cell evidence requirement: every **yes** / **partial** cell MUST cite the vendor-doc-url + commit-sha + snapshot-date triple from the adapter's pin. Every **no** cell cites the same triple plus a one-sentence rationale naming the vendor surface that lacks the capability. Every **discovery-pending** cell carries an inquiry-id per `rules/authority-inquiry.md` so the gap is tracked.
31
+
32
+ Per-row attestation surface: the adapter's gate-attestation block per `rules/pre-emission-gate.md` carries an `agent-capability-coverage: <yes | partial | no | discovery-pending>` field per column, mirrored from the matrix row.
33
+
34
+ Matrix-staleness check: a cell whose snapshot-date is older than 90 days against current vendor reality surfaces as a finding per `rules/harness-adapter-shape.md` §6 stale-pin discipline. The companion's evidence chain is the parent rule's STANDARD CONVENTION PIN evidence chain — never duplicated, always referenced.
35
+
36
+ ### 1A. Web-Fetch / Browser-Retrieval Surface — the M2 Source-Accessibility Backing Dimension
37
+
38
+ The `web_fetch` supplemental column is the per-harness declaration of whether the harness exposes a vendor-native web-fetch / URL-retrieval / web-search / browser tool. It is the real backing dimension for `rules/source-accessibility.md` step 1's escalation — "retrieve it directly through the host's browser / fetch capability" — so the escalation reads a declared cell instead of assuming a capability. Each harness's `capabilities.yml` carries the `web_fetch` field as one of: **yes** / **no** / **partial** / **discovery-pending**, with the same per-cell evidence requirement as §1: a **yes** / **partial** cell cites the vendor-doc-url + commit-sha + snapshot-date triple from the adapter's pin; a **no** cell cites the triple plus a rationale; a **discovery-pending** cell carries the tracked-gap note. When a harness's `web_fetch` cell is **no** or **discovery-pending**, `rules/source-accessibility.md` step 2 (operator-interview escalation per `rules/authority-inquiry.md`) is the live path — the absence of a fetch capability does not abandon the trusted source, it routes the retrieval to the operator.
39
+
40
+ Current sweep state (web-fetch evidence pass, snapshot-date 2026-06-21): eight harnesses are vendor-confirmed and now carry an inline evidence triple (vendor-doc-url + snapshot-id + snapshot-date) in their `capabilities.yml` `web_fetch` comment block — **yes**: `claude_code` (built-in WebFetch + WebSearch), `gemini_cli` (built-in `web_fetch` + `google_web_search`, commit-pinned to the adapter's own immutable snapshot), `codex` (first-party web search tool, default-on for local tasks), `github_copilot` (Copilot CLI `web_fetch` tool, URL-permission-gated), `windsurf` (Cascade Web Search + URL Read, admin-toggle-gated); **partial**: `qwen_code` (built-in `web_fetch` yes, `web_search` removed → MCP-only), `opencode` (`webfetch` unconditional, `websearch` provider/env-gated), `cursor` (`@Web` user-invoked context search, no documented autonomous fetch tool). The remaining seven — `antigravity`, `codebuddy`, `hermes`, `kiro`, `open_claw`, `trae`, `zed` — stay **discovery-pending**: no authoritative vendor source was located in this sweep, and the §1 definition forbids asserting `no` (vendor lacks it) or `yes` (without the triple) absent evidence. The eight populated cells' canonical evidence home remains the STANDARD CONVENTION PIN per §1's per-cell requirement; the inline `capabilities.yml` triple is the interim machine-readable carrier until a pin refresh folds each triple into the adapter's pin "Native Surfaces" block (the open follow-up). The 15 STANDARD CONVENTION PINs were last pinned (2026-05-31) cataloging config-materialization surfaces (rules files, MCP registration surfaces, hooks, skills, commands, memory), not the vendor runtime tool catalog — the pin-refresh follow-up adds the web-fetch tool row to each populated harness's pin.
41
+
42
+ ### 1B. Per-Harness "(Recommended)"-Annotation Enforcement Gap (M5)
43
+
44
+ The `(Recommended)` option-label postfix is specified behaviorally at `rules/determinism.md` §1, `rules/option-annotation.md` / `rules/option-annotation-form.md`, and `rules/interactive-questions-canonical-shapes.md` §2.1. The **runtime well-formedness guard** for that postfix is `hooks/askuserquestion_validator.py`, which fires on the `AskUserQuestion` tool event and checks the rendered option set's recommended-marker placement and bidirectional bind at call time. That guard is wired into exactly **one** harness:
45
+
46
+ - **claude_code** — the validator is registered in the generated `templates/settings.json` (matcher `AskUserQuestion` → the `pretooluse-askuserquestion-recommended` hook message). claude_code is the **only** harness whose operators get a call-time guard on the `(Recommended)` rendering.
47
+ - **The other 14 harnesses** (antigravity, codebuddy, codex, cursor, gemini_cli, github_copilot, hermes, kiro, open_claw, opencode, qwen_code, trae, windsurf, zed) receive the `(Recommended)` discipline as **behavioral rules text only** — the rule prose is materialized into each harness's instruction surface, but no call-time validator inspects the rendered option set. The enforcement floor for these 14 is the pre-emission conformity sweep on authored artifacts (`conformity/option_annotation_grep.py`, `conformity/determinism_grep.py`), not a runtime call-time guard.
48
+
49
+ **Wiring candidates.** Among the 14 text-only harnesses, **codex** (`~/.codex/hooks.json` hook surface) and **qwen_code** (`settings.json` hooks namespace) are the hook-capable candidates for wiring the same `AskUserQuestion`-equivalent validator, since both ratify a hooks-pipeline surface in their pins (codex `hooks.json`; qwen_code `hook_learning_capture: settings.json-hooks`). gemini_cli also documents a native settings.json hooks surface but the adapter keeps hook prose as support material and registers no native hooks (see its `capabilities.yml`), so it is a secondary candidate behind codex and qwen_code. Wiring those two would close the runtime-enforcement gap for the harnesses that can host a call-time guard; the remaining rules-only harnesses stay on the authored-artifact conformity floor. This is a tracked divergence, not a defect — the `(Recommended)` discipline is materialized everywhere; only the call-time guard is claude_code-exclusive today.
50
+
51
+ ### 3. Per-Harness MCP-Surface Catalog
52
+
53
+ Per-harness MCP server registration surfaces, projected from the shared profile's canonical MCP inventory:
54
+
55
+ - **claude_code** — `mcpServers` block inside `~/.claude/settings.json` (user-scope) plus project-level `.mcp.json` (project-scope). The adapter's materializer renders both surfaces from the profile's MCP inventory.
56
+ - **cursor** — `~/.cursor/mcp.json` (user-scope) plus project-level `.cursor/mcp.json` analogue where the vendor supports per-project MCP scoping.
57
+ - **codex / opencode / open_claw / qwen_code / antigravity / hermes / gemini_cli / windsurf / github_copilot** — per-harness MCP surface declared at the adapter's STANDARD CONVENTION PIN under `canonical-filename:` and `canonical-schema:` fields per `rules/harness-adapter-shape.md` §6. Where the harness does not yet expose an MCP surface (matrix column 1 cell is **no** or **discovery-pending**), the adapter declares the absence and the profile's MCP inventory is materialized into a sibling fallback surface (e.g., a system-prompt-embedded MCP descriptor) where the vendor surface permits, or omitted with an explicit `[Refusal — …]` ledger row per the parent rule's disclosure surface.
58
+
59
+ Sharing discipline: the profile's MCP inventory is the single source of truth; a per-harness surface MUST NOT silently diverge from the inventory. Operator-authored per-harness override rows (a harness-specific MCP server the operator declares for one harness only) are recorded explicitly in the profile's `mcp.overrides.<harness>` block and carry a concrete-driver rationale per `rules/interactive-questions-canonical-shapes.md` §3.2.1.
60
+
61
+ Project-vs-user scoping: the profile's MCP entries declare scope (`user` / `project` / `both`) and the per-harness materializer projects the scope into the harness's ratified surface (claude_code's project-level `.mcp.json` vs. user-level `mcpServers` block; cursor's project-level `.cursor/mcp.json` vs. user-level `~/.cursor/mcp.json`; per-harness analogues).
62
+
63
+ Discovery-pending MCP surfaces: when a harness's pinned snapshot does not yet document an MCP surface, the adapter carries a `mcp-surface: discovery-pending` field in its STANDARD CONVENTION PIN until the vendor surface ratifies; the materializer refuses MCP materialization for that harness per the parent rule's §8 refusal-and-override flow.
64
+
65
+ ### 7. Per-Harness Agent-Memory-Convention Catalog
66
+
67
+ Per-harness agent-memory persistence semantics:
68
+
69
+ - **persists-across-sessions** — the harness's memory surface survives session boundaries (vendor-ratified durable memory; e.g., a `memory/` directory or a memory-store file the harness reads at session start). The adapter's materializer emits the cohort's shared memory content into the harness's ratified durable surface.
70
+ - **does-not-persist** — the harness has no durable memory surface; agent memory is session-local. The adapter declares the absence and the profile's memory content is projected into the harness's system-prompt template surface (parent rule §6) as a read-only memory snapshot at session start where the vendor surface permits, or omitted with an explicit ledger row.
71
+ - **migrates** — the harness's memory surface admits import from an adjacent harness's memory format (vendor-ratified memory portability). The adapter declares the migration source-and-target pair, the migration script (under `src/apothem/harnesses/<name>/memory_migration.py` or equivalent), and the migration's idempotency guarantees.
72
+
73
+ The per-harness memory-convention cell maps to matrix column 5 (agent-memory convention) of §1. The adapter's STANDARD CONVENTION PIN carries the memory-convention field under `agent-memory: persists-across-sessions | does-not-persist | migrates` with per-harness specifics (the durable surface's path, the migration source-and-target pair, the read-only-snapshot projection surface).
74
+
75
+ Cross-harness memory portability table: the aggregate per-harness memory-convention map lives at `_inputs/cross-harness-agent-capability-matrix.md` alongside the §1 matrix, with the `migrates` rows pointing to the migration scripts and the `does-not-persist` rows pointing to their fallback projection surface. The table is the canonical reference for cross-harness skill authorship that depends on durable memory.
76
+
77
+ Stale memory-convention detection: a memory-convention cell whose snapshot-date diverges from current vendor reality (e.g., the vendor introduced a memory surface after the pin's snapshot date) surfaces as a finding per the stale-pin discipline.
78
+
79
+ ## Enforcement
80
+
81
+ Path-filtered (the four glob patterns in this rule's `pathFilter` field — `**/src/apothem/harnesses/**`, `**/_inputs/cross-harness-agent-capability-matrix.md`, `**/.mcp.json`, `**/mcp.json`), demand-loaded companion to `rules/agent-capability-discipline.md` §1 / §3 / §7. The parent rule retains the standing directive, the plain-language boundary, the disclosure surface, the failure tells, and the bindings; this companion carries the per-harness capability matrix, the MCP-surface catalog, and the agent-memory-convention catalog.
82
+
83
+ ## Bindings (§0.j five-direction)
84
+
85
+ - **Drives →** ● Every adapter sub-package's per-capability cell value declaration co-resident with its STANDARD CONVENTION PIN. ● The aggregate cross-harness matrix materialization at `_inputs/cross-harness-agent-capability-matrix.md`. ● Every per-harness MCP-surface projection from the profile's MCP inventory. ● Every per-harness agent-memory-convention declaration and its cross-harness portability mapping.
86
+ - **Satisfies →** ● `rules/agent-capability-discipline.md` §1 / §3 / §7 Companion Sub-Rule Anchor pointers. ● The cross-harness adapter capability convergence baseline.
87
+ - **Established by ↑** ● `rules/agent-capability-discipline.md` (parent-rule anchors at §1 / §3 / §7). ● `rules/harness-adapter-shape.md` §4 adapter capability-coverage matrix. ● `rules/harness-adapter-shape.md` §6 STANDARD CONVENTION PIN (the co-resident discipline this companion's evidence chain references).
88
+ - **Gated by ←** ● The path-filter (the four glob patterns) — this rule demand-loads only on adapter / matrix / MCP-config artifact touches. ● `rules/agent-capability-discipline.md` always-on baseline (parent rule's §1 / §3 / §7 anchors must be live for the companion to demand-load coherently).
89
+ - **Cross-bound with ↔** ↔ `rules/agent-capability-discipline.md` (parent rule; §1 / §3 / §7 anchors bind this companion). ↔ `rules/harness-adapter-shape.md` (co-resident STANDARD CONVENTION PIN discipline at §6; per-cell evidence chain anchors to the same pin). ↔ `rules/host-discovery.md` (M1 — per-cell discovery walks the vendor surface per the discovery-record provenance schema). ↔ `rules/disclosure-ledger.md` (M2 — discovery-pending cells and stale-snapshot findings recorded). ↔ `conformity/agent_capability_grep.py` (the mechanical matcher operationalizes the per-cell evidence-chain check). ↔ `rules/source-accessibility.md` (the §1A `web_fetch` column is the backing dimension for that rule's step-1 browser/fetch escalation; reciprocal of its `Gated by ←` web-fetch citation). ↔ `rules/determinism.md` + `rules/option-annotation.md` (the §1B `(Recommended)`-rendering discipline whose per-harness runtime-enforcement wiring this companion catalogs).
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: "agent-capability-discipline"
3
+ description: "Cross-harness agentic discipline — the 17-harness adapter cohort is recognized as sophisticated AI agent systems; core and supplemental agentic capabilities converge via M14, anchor to per-adapter STANDARD CONVENTION PIN, validate at materializer time, and attest through adapter capability coverage."
4
+ pathFilter: ""
5
+ alwaysApply: true
6
+ ---
7
+
8
+ <!-- SPDX-License-Identifier: MIT -->
9
+
10
+ # Rule: Agent Capability Discipline
11
+
12
+ ## What this rule enforces
13
+
14
+ Binds cross-harness agentic discipline across the 17-harness adapter cohort (**antigravity, claude_code, codebuddy, codex, cursor, gemini_cli, github_copilot, hermes, kimi_code, kiro, open_claw, opencode, qwen_code, trae, windsurf, zed, glm**). Each adapter targets a sophisticated AI agent system. Core and supplemental capabilities MUST discover per vendor doc + commit-SHA-pinned snapshot (or adapter-local convention pin) co-resident with the adapter's STANDARD CONVENTION PIN per `rules/harness-adapter-shape.md` §6, project via M14, validate at materializer time, and attest through capability-coverage. No capability is assumed: every cell is evidence-backed or discovery-pending.
15
+
16
+ ## Pre-conditions
17
+
18
+ Applies on adapter, capability, and convergence touches.
19
+
20
+ ## Required behavior
21
+
22
+ ### 1. Per-harness agentic-capability matrix (Companion Sub-Rule Anchor)
23
+
24
+ Core dimensions per adapter: MCP server · sub-agent dispatch · tool-surface restriction · system-prompt template · agent-memory · output-style · custom-command · hooks-pipeline · skills-directory. Supplemental dimensions include recommended-postfix rendering and long-context/compaction continuity. See `rules/agent-capability-discipline-matrix.md` §1.
25
+
26
+ ### 2. Cross-harness sibling-convergence
27
+
28
+ Operator workflows project per-harness via `rules/systemic-participation.md` M14. A capability present in one adapter MUST project into every cohort sibling whose vendor supports it; divergences MUST be declared — silent omission is a silo finding.
29
+
30
+ ### 3. MCP registry / discovery / sharing (Companion Sub-Rule Anchor)
31
+
32
+ Profile carries canonical MCP inventory; per-harness materializers project into native surfaces. See `rules/agent-capability-discipline-matrix.md` §3.
33
+
34
+ ### 4. Sub-agent dispatch
35
+
36
+ Kebab-case names; per-harness ratified file shape. A sub-agent's tool-restriction boundary MUST equal its parent's allow-list intersected with its own restrictions — never widening the parent's. Return-contract per `rules/agent-orchestration.md` §3; converge across the cohort.
37
+
38
+ ### 5. Tool-surface restriction
39
+
40
+ The universal-deny floor binds regardless of any per-harness allow-list: secrets paths (`.env*`, `~/.ssh/**`, credentials), destructive shell ops (`rm -rf:*`, `sudo:*`, `git push --force*`), network-write to unsigned endpoints. No override silently widens it.
41
+
42
+ ### 6. System-prompt template
43
+
44
+ Profile system-prompt content projects into each harness's native template; overrides MUST cite a concrete driver per `rules/interactive-questions-canonical-shapes.md` §3.2.1.
45
+
46
+ ### 7. Agent-memory convention (Companion Sub-Rule Anchor)
47
+
48
+ Per-harness memory semantics: persists / does-not-persist / migrates. See `rules/agent-capability-discipline-matrix.md` §7.
49
+
50
+ ### 8. Materializer detection + post-install validation
51
+
52
+ Materializers MUST probe vendor support before emission. When a profile declares a capability the pinned snapshot lacks, the materializer refuses unless the operator overrides via `rules/interactive-questions.md` §6. Post-install re-probe surfaces drift as a finding.
53
+
54
+ ### 9. Agent-Capability Coverage attestation
55
+
56
+ The adapter matrix per `rules/harness-adapter-shape.md` §4 carries a capability-coverage column: every §1 capability MUST have a covering test, attested in the adapter's gate block per `rules/pre-emission-gate.md`.
57
+
58
+ ## Plain-language boundary
59
+
60
+ Agentic vocabulary (AI / agent / sub-agent / MCP / tool-surface / harness names) is in-scope process-artifact vocabulary for adapter sub-packages, materializers, dev tech-spec, rule-tier. User-facing landing prose remains under `rules/plain-language.md`; this rule does not relax that boundary.
61
+
62
+ ## Disclosure surface
63
+
64
+ - `[Discovery — source: <harness>/STANDARD-CONVENTION-PIN.md; capability: <name>; vendor-support: <yes | no | partial>; honored]`
65
+ - `[Divergence — harness: <name>; capability: <name>; rationale: <concrete-driver>]`
66
+ - `[Refusal — materializer: <harness>; capability: <name>; reason: vendor-snapshot lacks support; operator-override: <yes | no>]`
67
+
68
+ ## Failure tells
69
+
70
+ Profile declares unsupported capability without §8 refusal. Sub-agent widens universal-deny without divergence record. Skill projected into one harness, silently omitted from another despite vendor support. Capability-coverage column blank. User-facing surface leaks agentic vocabulary outside in-scope boundary.
71
+
72
+ ## Bindings (§0.j five-direction)
73
+
74
+ - **Drives →** Adapter capability declarations co-resident with STANDARD CONVENTION PIN; materializer vendor-support probes; adapter capability-coverage attestation; the matcher `conformity/agent_capability_grep.py`.
75
+ - **Satisfies →** The cross-harness agentic-discipline baseline; `rules/harness-adapter-shape.md` §4 capability-coverage matrix; `rules/harness-adapter-shape.md` §6 STANDARD CONVENTION PIN discipline.
76
+ - **Established by ↑** `rules/harness-adapter-shape.md` §4 and §6; `CLAUDE.md` Harness Adapter Pattern section.
77
+ - **Gated by ←** `CLAUDE.md` preamble; `rules/plain-language.md` boundary.
78
+ - **Cross-bound with ↔** `rules/agent-capability-discipline-matrix.md` (companion §1 / §3 / §7); `rules/harness-adapter-shape.md` (PIN §6); `rules/plain-language.md`; `rules/systemic-participation.md` (M14); `rules/agent-orchestration.md` (CM-17 / CM-25); `rules/interactive-questions.md` (§6); `conformity/agent_capability_grep.py`.
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: "agent-orchestration-patterns"
3
+ description: "Path-filtered companion sub-rule carrying the team-pattern catalog, agent-type selection, launch protocol, return-contract enforcement, isolation discipline, error handling, decision tree, and anti-patterns that the parent `agent-orchestration.md` rule's anchors declare."
4
+ pathFilter: "**/agents/**/*.md, **/commands/plan-*.md, **/skills/**/SKILL.md, **/rules/agent-orchestration*.md"
5
+ alwaysApply: false
6
+ ---
7
+
8
+ <!-- SPDX-License-Identifier: MIT -->
9
+
10
+ # Rule: Agent Orchestration Patterns (Companion Sub-Rule)
11
+
12
+ ## Purpose
13
+
14
+ Carry the operational detail of agent and agent-team orchestration the parent `rules/agent-orchestration.md` rule's anchors point to. Demand-loaded when the assistant edits agent definitions, plan-pipeline commands, skills, or the parent rule. The parent retains the standing directive, the heuristic summary, the return-contract invariant, and the seriousness-scaling table; this companion carries the six team patterns, the agent-type-selection menu, the launch-protocol detail, return-contract enforcement, isolation/non-duplication detail, error handling, the decision-tree diagram, and the anti-pattern list.
15
+
16
+ ## Obligations
17
+
18
+ ### 1. Agent Team Patterns
19
+
20
+ Six canonical team patterns — match the pattern to the job. The **Agent Class** column names the harness-neutral agent capability the pattern needs; §2.2 maps each class to a concrete per-harness realization.
21
+
22
+ | Team Pattern | Purpose | Agent Class | Parallelism | Return Contract |
23
+ | ------------ | ------- | ----------- | ----------- | --------------- |
24
+ | **Research Team** | Information gathering, codebase exploration, skill scanning | read-only exploration agent | Full parallel | Structured summary, max 500 tokens per agent |
25
+ | **Audit Team** | Consistency checks, traceability, verification, spot-checks | full-tool multi-step agent | Full parallel | Pass/fail verdict + evidence citations |
26
+ | **Implementation Team** | Parallel non-overlapping code changes, file writes | full-tool multi-step agent | Parallel (non-overlapping files only) | Confirmation + file list + diff summary |
27
+ | **Generation Team** | Parallel file creation (plan artifacts, docs, reports) | full-tool multi-step agent | Full parallel (one file per agent) | Confirmation + generated file path |
28
+ | **Quality Team** | Parallel quality gates (lint, test, type-check, security) | full-tool multi-step agent | Full parallel | Pass/fail + failure details |
29
+ | **Documentation Team** | Parallel doc/guide updates | full-tool multi-step agent | Full parallel (non-overlapping files) | Confirmation + updated file path |
30
+
31
+ ### 2. Deployment Decision Framework
32
+
33
+ **2.1 — Deployment Decision.** **Deploy** when ANY holds: 3+ independent parallel operations, multi-path exploration, heavy reads that bloat the main context, multi-dimension verification, or multi-file generation. **Skip** when ANY holds: <3 total operations, tightly-coupled sequential steps, coordination overhead exceeds the parallelism benefit, or the main context already holds the needed information.
34
+
35
+ **2.1.1 — Spawn-Overhead Threshold (measurement insight).** Per-task agent spawn (a separate harness session) costs ~5-30s of latency on most hosts; in-process parallelism via `src/apothem/lib/parallel_sweep.py` ProcessPoolExecutor costs ~50-300ms per worker on Windows (~10-50ms on POSIX). Both carry non-trivial fixed costs that dominate when per-task work is small. Concrete dispatch decisions:
36
+
37
+ - **Research Team (parallel exploration).** Deploy when each agent reads 5+ files or pursues a distinct thread — per-agent work (reads + pattern matching + summary synthesis) takes seconds, amortizing spawn overhead. **Skip** when one Read or Grep answers the question — direct dispatch beats spawn.
38
+ - **Quality Team (parallel lint/test/type-check).** Deploy when the host has 3+ independent gates each taking seconds-to-minutes (full pytest, full ruff scan, full `mypy --strict`) — spawn overhead is dwarfed by gate runtime. **Skip** for sub-second linters or single-file checks.
39
+ - **Generation Team (parallel non-overlapping authorship).** Deploy when generating 3+ artifacts each needing substantial composition (a fresh skill, rule, or ADR). **Skip** for small-scope edits, or when artifacts carry substantive cross-references needing post-spawn reconciliation.
40
+ - **In-process parallelism via `src/apothem/lib/parallel_sweep.py`** fits cross-file sweeps where per-file work is **substantial** (≥ 50ms/file, ≥ 20 files). Measured: at 0.67ms-per-matcher on the conformity-gate orchestrator, ProcessPoolExecutor would slow the work 150-450× rather than speed it up. The module documents its when-to-use-vs-avoid criteria.
41
+
42
+ **2.1.2 — Standing Delegation Default (lean-context posture).** Beyond the §2.1 deploy/skip thresholds, a **standing routing default** governs *where* delegable work runs once the host exposes agent / subagent dispatch: broad reads, large-corpus consumption, and heavy single-thread workloads SHOULD route to a spawned agent **by default** rather than executing in the main context, so the main conversation stays lean and the synthesized result — not the raw corpus — returns. This is a SHOULD posture on routing, not a third deploy trigger and not an obligation: it neither lowers the §2.1 deploy thresholds for *parallel team* dispatch nor makes the heavy multi-agent apparatus a clean-install default. The apparatus stays default-off per `rules/agnostic-posture.md` §1; this default reads alongside it as advisory guidance that activates only when (a) dispatch is reachable and (b) the workload is broad/heavy enough that keeping it out of the main context is the lean choice. Where no dispatch surface exists, the work runs in the main context with the size-aware read discipline of `rules/large-file-reading.md`. The parent rule (`rules/agent-orchestration.md` §2) carries the one-line standing-default summary; this subsection is its operational backing.
43
+
44
+ **2.2 — Agent Class Selection.** Each class names a harness-neutral capability; select by the work the subtask needs, then map the class to whatever the active harness exposes. Where the harness offers no matching agent surface, fall back to direct in-context tools.
45
+
46
+ - **Read-only exploration agent.** Codebase exploration, file discovery, pattern searching. Where the harness supports a thoroughness knob, scale it to the scope (targeted lookup, moderate sweep, exhaustive analysis). *Per-harness mapping (one of many):* on the claude_code harness, dispatch a `subagent_type: Explore` agent and set its thoroughness parameter.
47
+ - **Full-tool multi-step agent.** Tasks needing full tool access (reads, writes, shell). The prompt states the deliverable explicitly. *Per-harness mapping (one of many):* on the claude_code harness, dispatch a `subagent_type: general-purpose` agent.
48
+ - **Architecture/planning agent.** Implementation planning and design evaluation. Read-only; returns plans, not modifications. Ad-hoc deployment only (no team pattern). *Per-harness mapping (one of many):* on the claude_code harness, dispatch a `subagent_type: Plan` agent.
49
+ - **Lightweight tier — host low-cost model.** Quick straightforward subtasks (token counting, simple formatting, straightforward checks).
50
+ - **Balanced tier — host general-purpose model.** Moderate-complexity subtasks (code analysis, structured generation, standard verification).
51
+ - **Deep-reasoning tier — explicitly-requested high-capability model.** High-complexity subtasks (architectural decisions, forensic audits, nuanced analysis), only where the host exposes model selection and the extra cost is justified.
52
+
53
+ ### 3. Launch Protocol
54
+
55
+ **3.1 — Prompt Engineering.** Every agent prompt MUST carry six elements:
56
+
57
+ - **Mission** — a clear, specific statement of what the agent must accomplish.
58
+ - **Deliverable** — the exact format and content of the expected return (e.g., "Return a JSON object with keys: status, findings, evidence").
59
+ - **Constraints** — boundaries on what the agent MUST NOT do (e.g., "Do NOT modify any files", "Do NOT read more than 10 files").
60
+ - **Context** — essential context not available in the codebase (decisions made earlier in the conversation, user preferences).
61
+ - **Return contract** — the maximum token budget for the return payload. Defaults: 500 (research), 200 (audit/quality), 500 (implementation/documentation), 1000 (generation). Persistent agent definitions (`agents/*.md`) MAY override these defaults.
62
+ - **File scope (Implementation Teams only)** — the exclusive file set the agent MAY modify. No two parallel agents share a file in their scope; verify non-overlap before launch.
63
+
64
+ **3.2 — Parallel Launch.** Launch all independent agents in a SINGLE turn using the harness's agent-dispatch surface (one dispatch per agent). Never launch independent agents sequentially. Group dependent agents into waves: Wave 1 (independent) → collect results → Wave 2 (dependent on Wave 1). *Per-harness mapping (one of many):* on the claude_code harness, emit multiple Agent tool calls in one message.
65
+
66
+ **3.3 — Background vs. Foreground.**
67
+
68
+ - **Foreground (default)** — when results are needed before proceeding; the norm for research, audit, and quality teams.
69
+ - **Background — where the harness exposes a detached-dispatch mode.** When genuinely-independent work runs concurrently (comprehensive test suites, large-scale generation, deep exploration), dispatch the agent in the background and do NOT poll or sleep — completion notifies you. *Per-harness mapping (one of many):* on the claude_code harness, pass `run_in_background: true`. Where the harness has no detached mode, run the work in the foreground or sequence it.
70
+
71
+ ### 4. Return Contract Enforcement
72
+
73
+ **4.1 — Contract Specification.** Every launch MUST specify the contract in the prompt: expected format, maximum size, required fields, and the fallback shape when the agent cannot fulfill it (e.g., "If no matching files found, return `{status: 'empty', reason: '...'}`").
74
+
75
+ **4.2 — Result Processing.** Process all parallel results in a single pass, never piecemeal. Verify each against its contract. A result over budget: extract only the critical fields, discard the verbose output. A malformed or incomplete result: log the failure, then retry once or proceed without that agent's contribution.
76
+
77
+ **4.3 — Context Integration.** Synthesize a compact summary and release the raw results from active context. Externalize per `rules/context-management.md` §2.1 when results contain decisions; otherwise externalize synthesized results with lasting value. Never hold raw agent output beyond the turn it is processed.
78
+
79
+ ### 5. Isolation and Non-Duplication
80
+
81
+ **5.1 — Work Isolation.** Each agent operates on a defined, non-overlapping scope. Two agents touching the same file MUST NOT run in parallel — sequence them. When agents make independent changes that share write paths, use the harness's per-agent isolation surface where one exists (a temporary git worktree per agent so parallel writes do not collide). Verify the harness exposes such a surface before relying on it; if absent, sequence the agents. *Per-harness mapping (one of many):* on the claude_code harness, set the Agent tool's `isolation: "worktree"` parameter.
82
+
83
+ **5.2 — Non-Duplication.** The main context MUST NOT perform research an agent is performing, nor re-read files an agent is reading unless the results are insufficient. Track which agents do what; prevent redundant work.
84
+
85
+ **5.3 — Coherence Verification.** After parallel agents complete, verify their outputs are mutually consistent. Contradictory findings are investigated and resolved before proceeding. For Implementation Teams: verify parallel code changes integrate — run tests/builds after merging.
86
+
87
+ ### 6. Error Handling and Recovery
88
+
89
+ - **Agent timeout.** Continue other work — completion notifies you. Do NOT spawn a duplicate.
90
+ - **Agent failure.** Log it; retry once with a refined prompt; on a second failure, proceed without that agent's contribution and document the gap.
91
+ - **Parallel team failure threshold.** When 2+ agents in the same team fail (including retries), treat the team result as degraded — inform the user of the coverage gap before proceeding. CM-18 escalation (3 cumulative failures) applies across all teams in the session, not per-team.
92
+ - **Result conflict.** Escalate contradictory results to the main context; never silently pick one.
93
+ - **Context pressure from results.** Process in batches — synthesize batch 1, externalize, release, then batch 2.
94
+
95
+ ## Decision Tree
96
+
97
+ ```mermaid
98
+ %%{ init: { "theme": "neutral" } }%%
99
+ %% verified: 2026-04-27 %%
100
+ %% provenance: rules/agent-orchestration-patterns.md §2.1 (deployment decision) + §2.2 (agent type selection) %%
101
+ %% cross-reference: rules/agent-orchestration-patterns.md §Decision Tree (in-rule per-subagent dispatch tree) %%
102
+ flowchart TD
103
+ Start[Orchestrator considers offloading work] --> Q1{3+ independent operations OR multi-path exploration OR heavy reads OR multi-dimension verification?}
104
+ Q1 -->|no| Direct[Skip subagent · use direct tools]
105
+ Q1 -->|yes| Q2{Task class}
106
+ Q2 -->|Read-only exploration| Explore[Read-only exploration agent · specify thoroughness]
107
+ Q2 -->|Architectural planning| Plan[Architecture/planning agent · ad-hoc only]
108
+ Q2 -->|Multi-step write or build| GP[Full-tool multi-step agent · enumerate file scope]
109
+ Explore --> Q3{Multiple independent agents to launch?}
110
+ Plan --> Q3
111
+ GP --> Q3
112
+ Q3 -->|yes| Parallel[Launch all in single turn · non-overlapping file scopes]
113
+ Q3 -->|no| Solo[Launch single agent]
114
+ Parallel --> Q4{Agents touch same file?}
115
+ Q4 -->|yes| Worktree[Use harness isolation surface OR sequence agents]
116
+ Q4 -->|no| Contract[Specify return contract per task class]
117
+ Solo --> Contract
118
+ Worktree --> Contract
119
+ Contract --> Synth[Synthesize · release raw output · externalize per CM-24]
120
+ Synth --> Q5{Outputs consistent across agents?}
121
+ Q5 -->|no| Resolve[Investigate contradictions · escalate to main context]
122
+ Q5 -->|yes| Done[Integrate results]
123
+ ```
124
+
125
+ ## Anti-Patterns
126
+
127
+ - **DON'T** launch a single agent for a task that a direct tool call can handle — **BECAUSE** agent overhead (prompt, launch, result processing) exceeds the benefit for single-operation tasks.
128
+ - **DON'T** launch agents sequentially when they have no dependencies between them — **BECAUSE** sequential launch wastes time proportional to the number of agents.
129
+ - **DON'T** duplicate work between the main context and agents — **BECAUSE** it wastes tokens and risks contradictory results.
130
+ - **DON'T** hold raw agent results in context after processing — **BECAUSE** verbose results consume context budget without ongoing value.
131
+ - **DON'T** launch agents without explicit return contracts — **BECAUSE** unbounded returns bloat the main context and create unpredictable token consumption.
132
+ - **DON'T** use the deep-reasoning tier for simple verification tasks — **BECAUSE** the lightweight or balanced tier accomplishes the same result at lower cost and latency.
133
+
134
+ ## Enforcement
135
+
136
+ Path-filtered (the four glob patterns in this rule's `pathFilter` field), always-on at every seriousness level when in scope. Demand-loaded companion to `rules/agent-orchestration.md`. The parent rule carries the standing directive, the deployment-heuristic summary, the return-contract invariant statement, and the seriousness-scaling table; this companion carries the team-pattern catalog, the agent-type-selection menu, the launch-protocol detail, return-contract enforcement bodies, isolation/non-duplication detail, error-handling detail, the decision-tree diagram, and the anti-pattern list.
137
+
138
+ ## Bindings (§0.j five-direction)
139
+
140
+ - **Drives →** ● Every agent deployment decision's pattern selection (§1 team-pattern catalog). ● Every parallel agent team launch (§3.2 single-message parallel-launch invariant). ● Every agent prompt's six-element shape (§3.1 prompt engineering). ● Every return-contract enforcement loop (§4 contract specification + result processing + context integration). ● The Implementation Team file-scope-non-overlap invariant (§3.1 file scope; §5.1 isolation worktree).
141
+ - **Satisfies →** ● CM-17 (Agent Teams) and CM-25 (Agent Orchestration; rule-delegated). ● the rules registry row "Agent Orchestration" (companion-tier specification). ● `rules/agent-orchestration.md` Companion Sub-Rule Anchor (the parent rule's pointer to this companion's full specification).
142
+ - **Established by ↑** ● `rules/agent-orchestration.md` (parent-rule anchor). ● CM-17 + CM-25. ● the agents registry (the persistent agent definitions consume this companion's deployment patterns).
143
+ - **Gated by ←** ● The path-filter (`**/agents/**/*.md`, `**/commands/plan-*.md`, `**/skills/**/SKILL.md`, `**/rules/agent-orchestration*.md`) — this rule demand-loads only on agent-orchestration-touching artifact edits. ● `rules/agent-orchestration.md` always-on baseline (parent rule must be live for the companion anchor to surface).
144
+ - **Cross-bound with ↔** ↔ `rules/agent-orchestration.md` (parent rule; the Companion Sub-Rule Anchor binds this companion). ↔ `agents/codebase-explorer.md` + `agents/convention-auditor.md` + `agents/quality-gate.md` + `agents/memory-auditor.md` (the four persistent flat agent definitions this companion's §1 team patterns dispatch to). ↔ `rules/agent-orchestration-patterns.md` §Decision Tree (the in-rule per-agent dispatch tree the §2.2 agent-class-selection cross-references). ↔ `rules/context-management.md` (post-multi-agent compaction trigger; §6 result-processing externalizes agent results per CM-24). ↔ `rules/operational-mandates.md` (CM-17 + CM-25 inline-defined there).
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: "agent-orchestration"
3
+ description: "Agent and agent team orchestration — the six canonical team patterns (Research, Audit, Implementation, Generation, Quality, Documentation), the deploy-when threshold (3+ independent parallel operations, multi-path exploration, heavy reads, multi-dimension verification, multi-file generation), the single-message parallel-launch invariant, explicit return contracts, and context isolation. Canonical specification for CM-17 / CM-25."
4
+ pathFilter: ""
5
+ alwaysApply: true
6
+ ---
7
+
8
+ <!-- SPDX-License-Identifier: MIT -->
9
+
10
+ # Rule: Agent Orchestration
11
+
12
+ ## Purpose
13
+
14
+ Govern agent deployment: maximize parallelism, enforce return contracts, isolate context, prevent duplication and contradiction. Canonical specification for CM-17 (Agent Teams) and CM-25 (Agent Orchestration).
15
+
16
+ ## Obligations
17
+
18
+ ### 1. Standing Directive
19
+
20
+ Deploy agent teams to maximize parallelism, enforce return contracts, isolate context, and prevent duplication and contradiction. Six canonical team patterns — **Research**, **Audit**, **Implementation**, **Generation**, **Quality**, **Documentation** — each binding an agent type, a parallelism shape, and a return-contract template. (Companion Sub-Rule Anchor) See `rules/agent-orchestration-patterns.md` §1 for the full team-pattern catalog.
21
+
22
+ ### 2. Deployment Heuristic
23
+
24
+ **Deploy** when ANY holds: 3+ independent parallel operations, multi-path exploration, heavy reads that bloat the main context, multi-dimension verification, or multi-file generation. **Skip** when ANY holds: <3 operations, tightly-coupled sequential steps, coordination overhead exceeds the parallelism benefit, or the main context already holds the needed information.
25
+
26
+ **Standing delegation default (lean-context posture).** Where the host exposes agent / subagent dispatch, broad reads, large-corpus consumption, and heavy workloads SHOULD route to a spawned agent **by default** — keeping the main context lean is the standing posture, not only the explicit opt-in path. This is advisory SHOULD-guidance about *where* delegable work runs when dispatch is available; it never makes the heavy multi-agent apparatus a clean-install obligation. The apparatus itself stays default-off per `rules/agnostic-posture.md` §1; this default governs only routing once delegation is reachable. Where the host exposes no dispatch surface, the work runs in the main context. (Companion Sub-Rule Anchor) See `rules/agent-orchestration-patterns.md` §2 for agent-type selection (`Explore` / `general-purpose` / `Plan`) and model-tier selection (lightweight / balanced / deep-reasoning).
27
+
28
+ ### 3. Launch Protocol
29
+
30
+ Every agent prompt MUST carry six elements: Mission + Deliverable + Constraints + Context + Return contract + File scope (Implementation Teams). Independent agents MUST launch in a SINGLE message with multiple Agent tool calls; dependent agents are grouped into waves (Wave 1 independent → collect → Wave 2 dependent). Foreground is the default; `run_in_background: true` is for genuinely-independent long-running work — never poll or sleep. (Companion Sub-Rule Anchor) See `rules/agent-orchestration-patterns.md` §3 for the full prompt-engineering, parallel-launch, and background/foreground specification.
31
+
32
+ ### 4. Return Contract Invariant
33
+
34
+ Every agent launch MUST specify an explicit return contract: format, maximum size, required fields, and fallback shape. Results are processed in a single pass, verified against the contract, synthesized into a compact summary, and the raw output is released — never held in context beyond the turn it is processed. (Companion Sub-Rule Anchor) See `rules/agent-orchestration-patterns.md` §4 for contract-specification, result-processing, and context-integration detail.
35
+
36
+ ### 5. Isolation, Non-Duplication, Error Handling
37
+
38
+ Each agent operates on a non-overlapping scope; agents touching the same file MUST be sequenced or use `isolation: "worktree"`. The main context MUST NOT duplicate work an agent is performing. Parallel outputs are checked for consistency before integration. Timeouts continue; failures retry once; 2+ team failures degrade the team result; contradictions escalate to the main context. (Companion Sub-Rule Anchor) See `rules/agent-orchestration-patterns.md` §5–§6 for isolation, non-duplication, coherence-verification, and error-handling detail.
39
+
40
+ ### 6. Decision Tree and Anti-Patterns
41
+
42
+ The orchestration decision tree (deploy / skip → agent type → parallel / solo → isolation → return contract → synthesize) and the six canonical anti-patterns (single-agent-for-direct-tool-task, sequential-when-parallel, main-context-duplicating-agent-work, raw-results-held-in-context, no-return-contract, deep-reasoning-on-trivial-task). (Companion Sub-Rule Anchor) See `rules/agent-orchestration-patterns.md` Decision Tree + Anti-Patterns sections.
43
+
44
+ ## Seriousness Scaling
45
+
46
+ > **Two-axis scaling note.** Unlike most rules (single column), this scaling table tracks two orthogonal dimensions: **deployment requirement** (when to use agents at all) and **agent sophistication** (which model tier to prefer). They scale at different rates with seriousness — e.g., a SHARED project may demand parallel teams (axis 1) while still using balanced-tier models for routine work (axis 2). Read the columns independently.
47
+
48
+ | Level | Agent Team Requirement | Agent Sophistication |
49
+ | ----- | ---------------------- | -------------------- |
50
+ | EXPLORING | Optional | Lightweight tier for cost efficiency |
51
+ | PERSONAL_USE | Encouraged for parallelizable work | Balanced tier for standard tasks |
52
+ | SHARED | Required for 3+ independent parallel operations — strict return contracts enforced | Deep-reasoning tier for critical decisions, balanced tier for standard |
53
+ | PUBLIC_LAUNCH | Required for 2+ independent operations. Isolation verification after parallel completion | Deep-reasoning tier for all agents touching shared/public artifacts |
54
+
55
+ ## Enforcement
56
+
57
+ Always-on at every seriousness level, scaling per the table above. Implements CM-17/CM-25. Canonical specification for agent and agent team orchestration.
58
+
59
+ ## Bindings (§0.j five-direction)
60
+
61
+ - **Drives →** ● Every agent deployment decision (§2.1 deployment heuristic; §2.2 agent-type selection). ● Every parallel agent team launch (§3.2 single-message parallel-launch invariant). ● Every agent's return-contract enforcement (§4 contract-specification + result-processing). ● Every `/plan-<stage>` command's agent-team specification (each decomposed plan command's Step 1 cites "Research Team", Step 4 cites "Quality Team", etc., per the canonical six team patterns). ◐ The Implementation Team file-scope-non-overlap invariant (§1 + §3.1 file scope; isolation worktree per §5.1).
62
+ - **Satisfies →** ● CM-17 (Agent Teams) and CM-25 (Agent Orchestration; rule-delegated). ● the rules registry row "Agent Orchestration". ● the agents registry (the four persistent flat `<name>.md` definitions consume this rule's deployment patterns).
63
+ - **Established by ↑** ● CM-17 + CM-25. ● the artifact directories (agents/ directory class declaration). ● the agents registry (the persistent agent definitions).
64
+ - **Gated by ←** ● `CLAUDE.md` always-loaded preamble. ● The harness's agent-spawn capability (Agent tool surface; subagent-type schema). ● `rules/operational-mandates.md` (CM-1 critical evaluation governs the deploy/skip decision at §2.1).
65
+ - **Cross-bound with ↔** ↔ `rules/agent-orchestration-patterns.md` (path-filtered companion sub-rule carrying the team-pattern catalog, agent-type selection, launch protocol, return-contract enforcement, isolation discipline, error handling, decision tree, and anti-patterns). ↔ `agents/codebase-explorer.md` + `agents/convention-auditor.md` + `agents/quality-gate.md` + `agents/memory-auditor.md` (the four persistent flat agent definitions this rule's §1 team patterns dispatch to). ↔ `rules/agent-orchestration-patterns.md` §Decision Tree (the per-subagent dispatch tree the §2.2 agent-type-selection decision tree cross-references). ↔ `rules/context-management.md` (post-multi-agent compaction trigger lives at §3 of that rule; this rule's §6 result-processing externalizes agent results per CM-24). ↔ `rules/operational-mandates.md` (CM-17 + CM-25 inline-defined there; this rule is the canonical specification). ↔ `rules/agent-capability-discipline.md` (CM-17 / CM-25 — agent-capability matrix dispatches under the orchestration patterns declared here). ↔ `rules/agnostic-posture.md` (agent-team dispatch is opt-in under the host-agnostic posture, not a default-on obligation). ↔ `rules/multi-agent-workflow.md` (the independent-critique / open-loop / dynamic multi-agent capability declared there runs through the team-pattern catalog, launch protocol, return contracts, and isolation discipline this rule owns; it references, never duplicates, them). ↔ `rules/refactoring-discipline.md` (§5.1 worktree isolation provides the isolated workspace for one-refactor-at-a-time). ↔ `rules/tool-use-discipline.md` (the §3 single-message parallel-launch invariant this rule binds at the agent tier is generalized down to ordinary tool calls there).