@invictus-group-ai/orchestra 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (466) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSING.md +49 -0
  3. package/README.md +507 -0
  4. package/assets/settings-template.json +99 -0
  5. package/bin/invi.js +6 -0
  6. package/content-dist/LICENSE +95 -0
  7. package/content-dist/PIPELINE.md +823 -0
  8. package/content-dist/README.md +128 -0
  9. package/content-dist/agents/README.md +135 -0
  10. package/content-dist/agents/mapping.json +476 -0
  11. package/content-dist/agents/stacks/backend-django.md +66 -0
  12. package/content-dist/agents/stacks/backend-dotnet.md +72 -0
  13. package/content-dist/agents/stacks/backend-fastapi.md +66 -0
  14. package/content-dist/agents/stacks/backend-laravel.md +66 -0
  15. package/content-dist/agents/stacks/backend-node.md +66 -0
  16. package/content-dist/agents/stacks/backend-spring.md +66 -0
  17. package/content-dist/agents/stacks/desktop-delphi.md +73 -0
  18. package/content-dist/agents/stacks/frontend-angular.md +65 -0
  19. package/content-dist/agents/stacks/frontend-react.md +67 -0
  20. package/content-dist/agents/stacks/frontend-svelte.md +67 -0
  21. package/content-dist/agents/stacks/frontend-vue.md +66 -0
  22. package/content-dist/agents/stacks/mobile-flutter.md +68 -0
  23. package/content-dist/agents/stacks/wordpress.md +66 -0
  24. package/content-dist/agents/universal/invi-qa.md +57 -0
  25. package/content-dist/agents/universal/invi-reviewer.md +61 -0
  26. package/content-dist/agents/universal/invi-security.md +55 -0
  27. package/content-dist/agents/universal/invi-tester.md +55 -0
  28. package/content-dist/agents/universal/invi-ui.md +85 -0
  29. package/content-dist/fragments/base.md +37 -0
  30. package/content-dist/fragments/domain/api-publica-rate-limiting.md +83 -0
  31. package/content-dist/fragments/domain/autenticacao-enterprise.md +86 -0
  32. package/content-dist/fragments/domain/busca-elasticsearch.md +86 -0
  33. package/content-dist/fragments/domain/dashboard-admin-rbac.md +80 -0
  34. package/content-dist/fragments/domain/design-system.md +71 -0
  35. package/content-dist/fragments/domain/ecommerce-completo.md +86 -0
  36. package/content-dist/fragments/domain/filas-jobs.md +80 -0
  37. package/content-dist/fragments/domain/integracao-crm-erp.md +82 -0
  38. package/content-dist/fragments/domain/lgpd.md +84 -0
  39. package/content-dist/fragments/domain/multi-tenancy.md +79 -0
  40. package/content-dist/fragments/domain/notificacoes-multicanal.md +81 -0
  41. package/content-dist/fragments/domain/pagamentos-brasil.md +85 -0
  42. package/content-dist/fragments/domain/plataforma-conteudo.md +77 -0
  43. package/content-dist/fragments/domain/realtime-websockets.md +92 -0
  44. package/content-dist/fragments/domain/relatorios-analytics.md +80 -0
  45. package/content-dist/fragments/domain/saas-stripe-billing.md +79 -0
  46. package/content-dist/fragments/domain/sistema-pagamentos.md +81 -0
  47. package/content-dist/fragments/domain/upload-midia.md +81 -0
  48. package/content-dist/fragments/domain/whatsapp-business.md +82 -0
  49. package/content-dist/fragments/index.json +1670 -0
  50. package/content-dist/fragments/references/angular-ngrx/app-config-and-testing.md +81 -0
  51. package/content-dist/fragments/references/angular-ngrx/store-pattern.md +155 -0
  52. package/content-dist/fragments/references/ansible-server-setup/layout-and-config.md +143 -0
  53. package/content-dist/fragments/references/ansible-server-setup/roles.md +238 -0
  54. package/content-dist/fragments/references/api-publica-rate-limiting/patterns.md +68 -0
  55. package/content-dist/fragments/references/astro-static/content-and-islands.md +117 -0
  56. package/content-dist/fragments/references/autenticacao-enterprise/pitfalls.md +70 -0
  57. package/content-dist/fragments/references/busca-elasticsearch/patterns.md +100 -0
  58. package/content-dist/fragments/references/chrome-extension-mv3/messaging-and-storage.md +109 -0
  59. package/content-dist/fragments/references/cli-typescript-commander/commands-and-config.md +136 -0
  60. package/content-dist/fragments/references/cloud-run-gcp/build-and-deploy.md +127 -0
  61. package/content-dist/fragments/references/cloud-run-gcp/iam-secrets-networking.md +65 -0
  62. package/content-dist/fragments/references/computer-vision-yolo/serving-and-export.md +182 -0
  63. package/content-dist/fragments/references/computer-vision-yolo/training-and-validation.md +131 -0
  64. package/content-dist/fragments/references/convex-react/functions.md +117 -0
  65. package/content-dist/fragments/references/convex-react/react-and-storage.md +109 -0
  66. package/content-dist/fragments/references/dashboard-admin-rbac/patterns.md +73 -0
  67. package/content-dist/fragments/references/data-pipeline-airflow/dag-patterns.md +149 -0
  68. package/content-dist/fragments/references/data-pipeline-airflow/operations.md +74 -0
  69. package/content-dist/fragments/references/delphi-object-pascal/legacy-extraction.md +175 -0
  70. package/content-dist/fragments/references/django-drf-celery/celery-tasks.md +47 -0
  71. package/content-dist/fragments/references/django-drf-celery/viewsets-and-serializers.md +92 -0
  72. package/content-dist/fragments/references/docker-compose-dev/compose-files.md +146 -0
  73. package/content-dist/fragments/references/docker-compose-dev/dockerfile-and-proxy.md +108 -0
  74. package/content-dist/fragments/references/dotnet-aspnet/data-and-di.md +90 -0
  75. package/content-dist/fragments/references/dotnet-aspnet/web-layer.md +88 -0
  76. package/content-dist/fragments/references/ecommerce-completo/patterns.md +76 -0
  77. package/content-dist/fragments/references/electron-app/ipc-bridge.md +123 -0
  78. package/content-dist/fragments/references/electron-app/security-and-packaging.md +134 -0
  79. package/content-dist/fragments/references/elixir-phoenix/context-and-web.md +112 -0
  80. package/content-dist/fragments/references/elixir-phoenix/processes.md +65 -0
  81. package/content-dist/fragments/references/filas-jobs/patterns.md +116 -0
  82. package/content-dist/fragments/references/fine-tuning-huggingface/data-and-export.md +114 -0
  83. package/content-dist/fragments/references/fine-tuning-huggingface/training-and-lora.md +123 -0
  84. package/content-dist/fragments/references/flutter/platform-channels-and-goldens.md +68 -0
  85. package/content-dist/fragments/references/flutter/state-and-widgets.md +95 -0
  86. package/content-dist/fragments/references/github-actions-cicd/workflows.md +235 -0
  87. package/content-dist/fragments/references/go-chi-gorm/http-layer.md +87 -0
  88. package/content-dist/fragments/references/go-chi-gorm/service-layer.md +58 -0
  89. package/content-dist/fragments/references/graphql-apollo/resolvers-and-loaders.md +128 -0
  90. package/content-dist/fragments/references/hono-bun/patterns.md +144 -0
  91. package/content-dist/fragments/references/integracao-crm-erp/patterns.md +100 -0
  92. package/content-dist/fragments/references/kubernetes-helm/chart-templates.md +162 -0
  93. package/content-dist/fragments/references/kubernetes-helm/secrets-storage-deploy.md +78 -0
  94. package/content-dist/fragments/references/langchain-python-agent/agent-and-cost.md +120 -0
  95. package/content-dist/fragments/references/langchain-python-agent/memory-and-resilience.md +76 -0
  96. package/content-dist/fragments/references/laravel/eloquent-and-queues.md +126 -0
  97. package/content-dist/fragments/references/laravel/http-layer.md +110 -0
  98. package/content-dist/fragments/references/lgpd/patterns.md +110 -0
  99. package/content-dist/fragments/references/llm-ops-production/routing-and-budget.md +118 -0
  100. package/content-dist/fragments/references/llm-ops-production/tracing-eval-ab.md +102 -0
  101. package/content-dist/fragments/references/microservices-docker/compose-and-gateway.md +93 -0
  102. package/content-dist/fragments/references/microservices-docker/events-and-correlation.md +88 -0
  103. package/content-dist/fragments/references/ml-fastapi-serving/metrics-drift-docker.md +97 -0
  104. package/content-dist/fragments/references/ml-fastapi-serving/serving-core.md +155 -0
  105. package/content-dist/fragments/references/ml-training-pipeline/dvc-pipeline.md +102 -0
  106. package/content-dist/fragments/references/ml-training-pipeline/mlflow-registry-ci.md +139 -0
  107. package/content-dist/fragments/references/monitoring-observability/alerts-and-config.md +169 -0
  108. package/content-dist/fragments/references/monitoring-observability/instrumentation-node.md +139 -0
  109. package/content-dist/fragments/references/multi-tenancy/patterns.md +85 -0
  110. package/content-dist/fragments/references/nestjs-typescript/guards-and-decorators.md +103 -0
  111. package/content-dist/fragments/references/nestjs-typescript/modules-dtos-setup.md +106 -0
  112. package/content-dist/fragments/references/nextjs-app-router/patterns.md +177 -0
  113. package/content-dist/fragments/references/nextjs-prisma-postgres/billing.md +167 -0
  114. package/content-dist/fragments/references/nextjs-trpc-drizzle/data-and-auth.md +121 -0
  115. package/content-dist/fragments/references/nextjs-trpc-drizzle/trpc-setup.md +62 -0
  116. package/content-dist/fragments/references/nodejs-express-typescript/config-and-tokens.md +48 -0
  117. package/content-dist/fragments/references/nodejs-express-typescript/middleware.md +108 -0
  118. package/content-dist/fragments/references/notificacoes-multicanal/patterns.md +78 -0
  119. package/content-dist/fragments/references/nuxt3-tailwind/server-routes.md +79 -0
  120. package/content-dist/fragments/references/nuxt3-tailwind/state-and-fetching.md +129 -0
  121. package/content-dist/fragments/references/openai-api-integration/calls.md +210 -0
  122. package/content-dist/fragments/references/openai-api-integration/client-and-cost.md +71 -0
  123. package/content-dist/fragments/references/pagamentos-brasil/gateways-reconciliation.md +92 -0
  124. package/content-dist/fragments/references/pagamentos-brasil/pix-boleto.md +115 -0
  125. package/content-dist/fragments/references/plataforma-conteudo/patterns.md +74 -0
  126. package/content-dist/fragments/references/python-fastapi/dependency-injection.md +99 -0
  127. package/content-dist/fragments/references/python-fastapi/settings-and-tasks.md +47 -0
  128. package/content-dist/fragments/references/rag-pipeline/ingestion.md +92 -0
  129. package/content-dist/fragments/references/rag-pipeline/retrieval-and-eval.md +148 -0
  130. package/content-dist/fragments/references/react-express-monolith/auth-and-client.md +110 -0
  131. package/content-dist/fragments/references/react-express-monolith/monorepo.md +71 -0
  132. package/content-dist/fragments/references/react-native-expo/native-patterns.md +103 -0
  133. package/content-dist/fragments/references/react-native-expo/navigation-and-auth.md +55 -0
  134. package/content-dist/fragments/references/react-ts-zustand-query/store-and-query.md +152 -0
  135. package/content-dist/fragments/references/react-typescript/feature-module.md +64 -0
  136. package/content-dist/fragments/references/react-typescript/forms-and-state.md +69 -0
  137. package/content-dist/fragments/references/react-typescript/recipes.md +37 -0
  138. package/content-dist/fragments/references/react-typescript/testing.md +40 -0
  139. package/content-dist/fragments/references/realtime-websockets/patterns.md +92 -0
  140. package/content-dist/fragments/references/relatorios-analytics/patterns.md +81 -0
  141. package/content-dist/fragments/references/remix-express-full/auth-and-uploads.md +88 -0
  142. package/content-dist/fragments/references/remix-express-full/express-server.md +54 -0
  143. package/content-dist/fragments/references/remix-typescript/auth-and-db.md +68 -0
  144. package/content-dist/fragments/references/remix-typescript/loaders-and-actions.md +98 -0
  145. package/content-dist/fragments/references/rust-axum/error-and-state.md +99 -0
  146. package/content-dist/fragments/references/rust-axum/handlers.md +87 -0
  147. package/content-dist/fragments/references/saas-stripe-billing/patterns.md +86 -0
  148. package/content-dist/fragments/references/serverless-lambda/handler-patterns.md +107 -0
  149. package/content-dist/fragments/references/sistema-pagamentos/pitfalls.md +54 -0
  150. package/content-dist/fragments/references/spring-boot/service-and-data.md +96 -0
  151. package/content-dist/fragments/references/spring-boot/web-layer.md +100 -0
  152. package/content-dist/fragments/references/supabase-nextjs/clients-and-middleware.md +102 -0
  153. package/content-dist/fragments/references/supabase-nextjs/rls-and-storage.md +86 -0
  154. package/content-dist/fragments/references/svelte-sveltekit/hooks-and-state.md +67 -0
  155. package/content-dist/fragments/references/svelte-sveltekit/load-and-actions.md +80 -0
  156. package/content-dist/fragments/references/t3-stack/routers-and-callers.md +75 -0
  157. package/content-dist/fragments/references/t3-stack/trpc-setup.md +60 -0
  158. package/content-dist/fragments/references/terraform-aws/modules-and-ci.md +114 -0
  159. package/content-dist/fragments/references/terraform-aws/state-and-workspaces.md +66 -0
  160. package/content-dist/fragments/references/turborepo-monorepo/pipeline-and-packages.md +84 -0
  161. package/content-dist/fragments/references/upload-midia/patterns.md +80 -0
  162. package/content-dist/fragments/references/vector-search-pinecone/client-and-upsert.md +98 -0
  163. package/content-dist/fragments/references/vector-search-pinecone/query-and-hybrid.md +81 -0
  164. package/content-dist/fragments/references/vps-deploy-producao/compose-prod.md +97 -0
  165. package/content-dist/fragments/references/vps-deploy-producao/proxy-and-operations.md +118 -0
  166. package/content-dist/fragments/references/vscode-extension/activation-and-tree.md +98 -0
  167. package/content-dist/fragments/references/vscode-extension/webview-csp.md +57 -0
  168. package/content-dist/fragments/references/vue3-pinia-vite/components-and-stores.md +73 -0
  169. package/content-dist/fragments/references/vue3-pinia-vite/queries-forms-testing.md +100 -0
  170. package/content-dist/fragments/references/whatsapp-business/patterns.md +107 -0
  171. package/content-dist/fragments/references/wordpress/hooks-and-security.md +92 -0
  172. package/content-dist/fragments/references/wordpress/wp-cli-gates.md +64 -0
  173. package/content-dist/fragments/stack/angular-ngrx.md +75 -0
  174. package/content-dist/fragments/stack/ansible-server-setup.md +69 -0
  175. package/content-dist/fragments/stack/astro-static.md +72 -0
  176. package/content-dist/fragments/stack/chrome-extension-mv3.md +66 -0
  177. package/content-dist/fragments/stack/cli-typescript-commander.md +66 -0
  178. package/content-dist/fragments/stack/cloud-run-gcp.md +63 -0
  179. package/content-dist/fragments/stack/computer-vision-yolo.md +62 -0
  180. package/content-dist/fragments/stack/convex-react.md +65 -0
  181. package/content-dist/fragments/stack/data-pipeline-airflow.md +64 -0
  182. package/content-dist/fragments/stack/delphi-object-pascal.md +63 -0
  183. package/content-dist/fragments/stack/django-drf-celery.md +63 -0
  184. package/content-dist/fragments/stack/docker-compose-dev.md +69 -0
  185. package/content-dist/fragments/stack/dotnet-aspnet.md +62 -0
  186. package/content-dist/fragments/stack/electron-app.md +70 -0
  187. package/content-dist/fragments/stack/elixir-phoenix.md +65 -0
  188. package/content-dist/fragments/stack/fine-tuning-huggingface.md +69 -0
  189. package/content-dist/fragments/stack/flutter.md +61 -0
  190. package/content-dist/fragments/stack/github-actions-cicd.md +73 -0
  191. package/content-dist/fragments/stack/go-chi-gorm.md +73 -0
  192. package/content-dist/fragments/stack/graphql-apollo.md +70 -0
  193. package/content-dist/fragments/stack/hono-bun.md +62 -0
  194. package/content-dist/fragments/stack/kubernetes-helm.md +67 -0
  195. package/content-dist/fragments/stack/langchain-python-agent.md +64 -0
  196. package/content-dist/fragments/stack/laravel.md +64 -0
  197. package/content-dist/fragments/stack/llm-ops-production.md +63 -0
  198. package/content-dist/fragments/stack/microservices-docker.md +70 -0
  199. package/content-dist/fragments/stack/ml-fastapi-serving.md +64 -0
  200. package/content-dist/fragments/stack/ml-training-pipeline.md +67 -0
  201. package/content-dist/fragments/stack/monitoring-observability.md +68 -0
  202. package/content-dist/fragments/stack/nestjs-typescript.md +68 -0
  203. package/content-dist/fragments/stack/nextjs-app-router.md +65 -0
  204. package/content-dist/fragments/stack/nextjs-prisma-postgres.md +61 -0
  205. package/content-dist/fragments/stack/nextjs-trpc-drizzle.md +63 -0
  206. package/content-dist/fragments/stack/nodejs-express-typescript.md +60 -0
  207. package/content-dist/fragments/stack/nuxt3-tailwind.md +62 -0
  208. package/content-dist/fragments/stack/openai-api-integration.md +58 -0
  209. package/content-dist/fragments/stack/python-fastapi.md +64 -0
  210. package/content-dist/fragments/stack/rag-pipeline.md +62 -0
  211. package/content-dist/fragments/stack/react-express-monolith.md +61 -0
  212. package/content-dist/fragments/stack/react-native-expo.md +68 -0
  213. package/content-dist/fragments/stack/react-ts-zustand-query.md +64 -0
  214. package/content-dist/fragments/stack/react-typescript.md +73 -0
  215. package/content-dist/fragments/stack/remix-express-full.md +63 -0
  216. package/content-dist/fragments/stack/remix-typescript.md +66 -0
  217. package/content-dist/fragments/stack/rust-axum.md +63 -0
  218. package/content-dist/fragments/stack/serverless-lambda.md +65 -0
  219. package/content-dist/fragments/stack/spring-boot.md +63 -0
  220. package/content-dist/fragments/stack/supabase-nextjs.md +64 -0
  221. package/content-dist/fragments/stack/svelte-sveltekit.md +67 -0
  222. package/content-dist/fragments/stack/t3-stack.md +63 -0
  223. package/content-dist/fragments/stack/terraform-aws.md +65 -0
  224. package/content-dist/fragments/stack/turborepo-monorepo.md +61 -0
  225. package/content-dist/fragments/stack/vector-search-pinecone.md +63 -0
  226. package/content-dist/fragments/stack/vps-deploy-producao.md +64 -0
  227. package/content-dist/fragments/stack/vscode-extension.md +64 -0
  228. package/content-dist/fragments/stack/vue3-pinia-vite.md +65 -0
  229. package/content-dist/fragments/stack/wordpress.md +63 -0
  230. package/content-dist/skills/invi-commit/SKILL.md +85 -0
  231. package/content-dist/skills/invi-journal/SKILL.md +67 -0
  232. package/content-dist/skills/invi-map/SKILL.md +118 -0
  233. package/content-dist/skills/invi-mode/SKILL.md +176 -0
  234. package/content-dist/skills/invi-pr/SKILL.md +142 -0
  235. package/content-dist/skills/invi-qa/SKILL.md +75 -0
  236. package/content-dist/skills/invi-refactor-legacy/SKILL.md +90 -0
  237. package/content-dist/skills/invi-review/SKILL.md +83 -0
  238. package/content-dist/skills/invi-security/SKILL.md +89 -0
  239. package/content-dist/skills/invi-status/SKILL.md +72 -0
  240. package/content-dist/skills/invi-task/SKILL.md +143 -0
  241. package/content-dist/skills/invi-test/SKILL.md +97 -0
  242. package/content-dist/skills/po-handoff/SKILL.md +130 -0
  243. package/content-dist/skills/po-intake/SKILL.md +115 -0
  244. package/content-dist/skills/po-lint/SKILL.md +82 -0
  245. package/content-dist/skills/po-spec/SKILL.md +138 -0
  246. package/content-dist/skills/po-status/SKILL.md +130 -0
  247. package/content-dist/skills/po-verify/SKILL.md +124 -0
  248. package/content-dist/templates/requirements/REQ-TEMPLATE.md +110 -0
  249. package/content-dist/templates/requirements/constitution-TEMPLATE.md +77 -0
  250. package/dist/baseline.d.ts +21 -0
  251. package/dist/baseline.d.ts.map +1 -0
  252. package/dist/baseline.js +43 -0
  253. package/dist/baseline.js.map +1 -0
  254. package/dist/cli.d.ts +15 -0
  255. package/dist/cli.d.ts.map +1 -0
  256. package/dist/cli.js +345 -0
  257. package/dist/cli.js.map +1 -0
  258. package/dist/commands/doctor.d.ts +31 -0
  259. package/dist/commands/doctor.d.ts.map +1 -0
  260. package/dist/commands/doctor.js +173 -0
  261. package/dist/commands/doctor.js.map +1 -0
  262. package/dist/commands/export.d.ts +49 -0
  263. package/dist/commands/export.d.ts.map +1 -0
  264. package/dist/commands/export.js +95 -0
  265. package/dist/commands/export.js.map +1 -0
  266. package/dist/commands/gate.d.ts +42 -0
  267. package/dist/commands/gate.d.ts.map +1 -0
  268. package/dist/commands/gate.js +97 -0
  269. package/dist/commands/gate.js.map +1 -0
  270. package/dist/commands/init.d.ts +88 -0
  271. package/dist/commands/init.d.ts.map +1 -0
  272. package/dist/commands/init.js +540 -0
  273. package/dist/commands/init.js.map +1 -0
  274. package/dist/commands/journalCmd.d.ts +47 -0
  275. package/dist/commands/journalCmd.d.ts.map +1 -0
  276. package/dist/commands/journalCmd.js +89 -0
  277. package/dist/commands/journalCmd.js.map +1 -0
  278. package/dist/commands/keys.d.ts +68 -0
  279. package/dist/commands/keys.d.ts.map +1 -0
  280. package/dist/commands/keys.js +240 -0
  281. package/dist/commands/keys.js.map +1 -0
  282. package/dist/commands/map.d.ts +123 -0
  283. package/dist/commands/map.d.ts.map +1 -0
  284. package/dist/commands/map.js +383 -0
  285. package/dist/commands/map.js.map +1 -0
  286. package/dist/commands/plan.d.ts +28 -0
  287. package/dist/commands/plan.d.ts.map +1 -0
  288. package/dist/commands/plan.js +64 -0
  289. package/dist/commands/plan.js.map +1 -0
  290. package/dist/commands/req.d.ts +92 -0
  291. package/dist/commands/req.d.ts.map +1 -0
  292. package/dist/commands/req.js +270 -0
  293. package/dist/commands/req.js.map +1 -0
  294. package/dist/commands/review.d.ts +40 -0
  295. package/dist/commands/review.d.ts.map +1 -0
  296. package/dist/commands/review.js +101 -0
  297. package/dist/commands/review.js.map +1 -0
  298. package/dist/commands/run.d.ts +33 -0
  299. package/dist/commands/run.d.ts.map +1 -0
  300. package/dist/commands/run.js +151 -0
  301. package/dist/commands/run.js.map +1 -0
  302. package/dist/commands/ship.d.ts +45 -0
  303. package/dist/commands/ship.d.ts.map +1 -0
  304. package/dist/commands/ship.js +252 -0
  305. package/dist/commands/ship.js.map +1 -0
  306. package/dist/commands/status.d.ts +36 -0
  307. package/dist/commands/status.d.ts.map +1 -0
  308. package/dist/commands/status.js +152 -0
  309. package/dist/commands/status.js.map +1 -0
  310. package/dist/commands/sync.d.ts +91 -0
  311. package/dist/commands/sync.d.ts.map +1 -0
  312. package/dist/commands/sync.js +331 -0
  313. package/dist/commands/sync.js.map +1 -0
  314. package/dist/commands/syncCommits.d.ts +56 -0
  315. package/dist/commands/syncCommits.d.ts.map +1 -0
  316. package/dist/commands/syncCommits.js +97 -0
  317. package/dist/commands/syncCommits.js.map +1 -0
  318. package/dist/commands/task.d.ts +108 -0
  319. package/dist/commands/task.d.ts.map +1 -0
  320. package/dist/commands/task.js +217 -0
  321. package/dist/commands/task.js.map +1 -0
  322. package/dist/commands/update.d.ts +92 -0
  323. package/dist/commands/update.d.ts.map +1 -0
  324. package/dist/commands/update.js +541 -0
  325. package/dist/commands/update.js.map +1 -0
  326. package/dist/commands/verifyTask.d.ts +50 -0
  327. package/dist/commands/verifyTask.d.ts.map +1 -0
  328. package/dist/commands/verifyTask.js +172 -0
  329. package/dist/commands/verifyTask.js.map +1 -0
  330. package/dist/content.d.ts +128 -0
  331. package/dist/content.d.ts.map +1 -0
  332. package/dist/content.js +177 -0
  333. package/dist/content.js.map +1 -0
  334. package/dist/detect.d.ts +122 -0
  335. package/dist/detect.d.ts.map +1 -0
  336. package/dist/detect.js +594 -0
  337. package/dist/detect.js.map +1 -0
  338. package/dist/events.d.ts +36 -0
  339. package/dist/events.d.ts.map +1 -0
  340. package/dist/events.js +76 -0
  341. package/dist/events.js.map +1 -0
  342. package/dist/frontmatter.d.ts +15 -0
  343. package/dist/frontmatter.d.ts.map +1 -0
  344. package/dist/frontmatter.js +74 -0
  345. package/dist/frontmatter.js.map +1 -0
  346. package/dist/i18n/en.d.ts +421 -0
  347. package/dist/i18n/en.d.ts.map +1 -0
  348. package/dist/i18n/en.js +443 -0
  349. package/dist/i18n/en.js.map +1 -0
  350. package/dist/i18n/index.d.ts +40 -0
  351. package/dist/i18n/index.d.ts.map +1 -0
  352. package/dist/i18n/index.js +66 -0
  353. package/dist/i18n/index.js.map +1 -0
  354. package/dist/i18n/pt-BR.d.ts +11 -0
  355. package/dist/i18n/pt-BR.d.ts.map +1 -0
  356. package/dist/i18n/pt-BR.js +435 -0
  357. package/dist/i18n/pt-BR.js.map +1 -0
  358. package/dist/identity.d.ts +78 -0
  359. package/dist/identity.d.ts.map +1 -0
  360. package/dist/identity.js +152 -0
  361. package/dist/identity.js.map +1 -0
  362. package/dist/index.d.ts +79 -0
  363. package/dist/index.d.ts.map +1 -0
  364. package/dist/index.js +48 -0
  365. package/dist/index.js.map +1 -0
  366. package/dist/insights.d.ts +86 -0
  367. package/dist/insights.d.ts.map +1 -0
  368. package/dist/insights.js +199 -0
  369. package/dist/insights.js.map +1 -0
  370. package/dist/interview.d.ts +81 -0
  371. package/dist/interview.d.ts.map +1 -0
  372. package/dist/interview.js +283 -0
  373. package/dist/interview.js.map +1 -0
  374. package/dist/inventory.d.ts +79 -0
  375. package/dist/inventory.d.ts.map +1 -0
  376. package/dist/inventory.js +86 -0
  377. package/dist/inventory.js.map +1 -0
  378. package/dist/journal.d.ts +22 -0
  379. package/dist/journal.d.ts.map +1 -0
  380. package/dist/journal.js +88 -0
  381. package/dist/journal.js.map +1 -0
  382. package/dist/migrations/legacyNames.d.ts +45 -0
  383. package/dist/migrations/legacyNames.d.ts.map +1 -0
  384. package/dist/migrations/legacyNames.js +118 -0
  385. package/dist/migrations/legacyNames.js.map +1 -0
  386. package/dist/plan.d.ts +42 -0
  387. package/dist/plan.d.ts.map +1 -0
  388. package/dist/plan.js +126 -0
  389. package/dist/plan.js.map +1 -0
  390. package/dist/render/agents.d.ts +327 -0
  391. package/dist/render/agents.d.ts.map +1 -0
  392. package/dist/render/agents.js +356 -0
  393. package/dist/render/agents.js.map +1 -0
  394. package/dist/render/claudeMd.d.ts +29 -0
  395. package/dist/render/claudeMd.d.ts.map +1 -0
  396. package/dist/render/claudeMd.js +110 -0
  397. package/dist/render/claudeMd.js.map +1 -0
  398. package/dist/render/githooks.d.ts +41 -0
  399. package/dist/render/githooks.d.ts.map +1 -0
  400. package/dist/render/githooks.js +168 -0
  401. package/dist/render/githooks.js.map +1 -0
  402. package/dist/render/markers.d.ts +13 -0
  403. package/dist/render/markers.d.ts.map +1 -0
  404. package/dist/render/markers.js +35 -0
  405. package/dist/render/markers.js.map +1 -0
  406. package/dist/render/requirements.d.ts +56 -0
  407. package/dist/render/requirements.d.ts.map +1 -0
  408. package/dist/render/requirements.js +86 -0
  409. package/dist/render/requirements.js.map +1 -0
  410. package/dist/render/settings.d.ts +43 -0
  411. package/dist/render/settings.d.ts.map +1 -0
  412. package/dist/render/settings.js +94 -0
  413. package/dist/render/settings.js.map +1 -0
  414. package/dist/render/transparency.d.ts +7 -0
  415. package/dist/render/transparency.d.ts.map +1 -0
  416. package/dist/render/transparency.js +164 -0
  417. package/dist/render/transparency.js.map +1 -0
  418. package/dist/requirements.d.ts +84 -0
  419. package/dist/requirements.d.ts.map +1 -0
  420. package/dist/requirements.js +229 -0
  421. package/dist/requirements.js.map +1 -0
  422. package/dist/sizing.d.ts +63 -0
  423. package/dist/sizing.d.ts.map +1 -0
  424. package/dist/sizing.js +104 -0
  425. package/dist/sizing.js.map +1 -0
  426. package/dist/tasks.d.ts +199 -0
  427. package/dist/tasks.d.ts.map +1 -0
  428. package/dist/tasks.js +320 -0
  429. package/dist/tasks.js.map +1 -0
  430. package/dist/util/diff3.d.ts +26 -0
  431. package/dist/util/diff3.d.ts.map +1 -0
  432. package/dist/util/diff3.js +112 -0
  433. package/dist/util/diff3.js.map +1 -0
  434. package/dist/util/fsx.d.ts +33 -0
  435. package/dist/util/fsx.d.ts.map +1 -0
  436. package/dist/util/fsx.js +153 -0
  437. package/dist/util/fsx.js.map +1 -0
  438. package/dist/util/git.d.ts +58 -0
  439. package/dist/util/git.d.ts.map +1 -0
  440. package/dist/util/git.js +171 -0
  441. package/dist/util/git.js.map +1 -0
  442. package/dist/util/merge.d.ts +27 -0
  443. package/dist/util/merge.d.ts.map +1 -0
  444. package/dist/util/merge.js +78 -0
  445. package/dist/util/merge.js.map +1 -0
  446. package/dist/util/out.d.ts +18 -0
  447. package/dist/util/out.d.ts.map +1 -0
  448. package/dist/util/out.js +23 -0
  449. package/dist/util/out.js.map +1 -0
  450. package/dist/util/proc.d.ts +12 -0
  451. package/dist/util/proc.d.ts.map +1 -0
  452. package/dist/util/proc.js +45 -0
  453. package/dist/util/proc.js.map +1 -0
  454. package/dist/util/registry.d.ts +58 -0
  455. package/dist/util/registry.d.ts.map +1 -0
  456. package/dist/util/registry.js +240 -0
  457. package/dist/util/registry.js.map +1 -0
  458. package/dist/verify.d.ts +52 -0
  459. package/dist/verify.d.ts.map +1 -0
  460. package/dist/verify.js +205 -0
  461. package/dist/verify.js.map +1 -0
  462. package/dist/version.d.ts +5 -0
  463. package/dist/version.d.ts.map +1 -0
  464. package/dist/version.js +18 -0
  465. package/dist/version.js.map +1 -0
  466. package/package.json +63 -0
@@ -0,0 +1,823 @@
1
+ # Invictus Pipeline — spec
2
+
3
+ Canonical contract for the pipeline skill pack (`content/skills/inv-*`, `content/skills/invi-mode`)
4
+ and the PO requirements pack (`content/skills/po-*`, §7).
5
+ Generalized from the proven legacy pilot kit;
6
+ everything project-specific comes from `.invictus/manifest.json` (ARCHITECTURE §3) — nothing is hardcoded.
7
+
8
+ Doctrine carried verbatim from the legacy pilot kit, binding for every pipeline skill:
9
+
10
+ - **Bounded fix loops** — max 2 correction cycles per gate; when exhausted, BLOCK and report precisely. Never spin.
11
+ - **Merge and deploy are ALWAYS human.** No skill, agent, or orchestration ever merges a PR or deploys.
12
+ - **Anti-hallucination honesty** — if the environment can't run a check, say "not verified" — never fake a pass, never invent findings. If there is nothing relevant to report, say so clearly.
13
+ - **One task = one branch = one goal.** A ticket that mixes goals is split before work starts.
14
+ - **Neighbor-pattern conformity** — find a neighboring file of the same feature class, copy its exact pattern, make the smallest coherent change.
15
+ - **Severity ladder with the client's #1 catastrophic risk as the first BLOCKER item** (`project.catastrophicRisk` in the manifest).
16
+ - **Structured parseable output blocks** end every skill — the machine seam between skills, the orchestrator, and the platform.
17
+
18
+ Language (D-003): this spec and the skills are canonical EN. Skills communicate with the user in the
19
+ language configured in `.invictus/manifest.json` (`language.render`, default `pt-BR`). Machine artifacts —
20
+ task JSON field names, output-block keys, enum values, event payloads — are always EN.
21
+
22
+ ---
23
+
24
+ ## 1. Canonical task JSON
25
+
26
+ The single shape every task source (pasted text, tracker adapter, PO intake, file) is normalized into.
27
+ Modeled on the legacy pilot golden ticket, with EN keys.
28
+
29
+ ```jsonc
30
+ {
31
+ "schema": 1,
32
+ "id": "tk4242", // MUST match manifest project.ticketPattern
33
+ "type": "feat", // feat|fix|refactor|test|docs|chore|perf|ci|build|style|hotfix
34
+ "title": "Validate duplicate CPF on person registration",
35
+ "description": "When registering a person, reject the registration when another person with the same CPF already exists in the same tenant. The same CPF must remain valid across different tenants.",
36
+ "acceptance_criteria": [
37
+ "Rejects a duplicate CPF within the same tenant",
38
+ "Returns the standard error result with a user-facing message, without throwing",
39
+ "Allows the same CPF in different tenants", // ← the risk case (see below)
40
+ "Covered by a unit test and a tenant-isolation integration test"
41
+ ],
42
+ "module": "membership", // scope/module slug; used as the commit scope. Optional.
43
+ "status": "open", // pipeline state, §3
44
+ "url": "https://tracker.example/tk4242", // link back to the source. Optional.
45
+ "source": "pasted | file | tracker | generated" // where the task came from. Optional.
46
+ }
47
+ ```
48
+
49
+ Rules:
50
+
51
+ - `id` must match the manifest `project.ticketPattern`. When no id can be recovered, the skill asks the
52
+ user (interactive) or mints `adhoc-<yyyymmdd>-<n>` and declares `ID_SOURCE: generated` (headless) —
53
+ loudly, never silently.
54
+ - `acceptance_criteria` MUST include the **risk case**: at least one criterion that exercises the client's
55
+ catastrophic risk (`project.catastrophicRisk`) whenever the change plausibly touches it. If the source
56
+ ticket lacks it, `invi-task` adds one and flags it (`RISK_CRITERION: added`).
57
+ - `title`/`description` keep the source ticket's original language — client content is never translated.
58
+ - Unknown extra fields are preserved on normalization (round-trip safe) and ignored by consumers.
59
+ - The PO layer (§7) adds the optional extension field `req: ["REQ-104"]` and prefixes criteria it maps
60
+ with their AC id (`"[AC-104.1] …"`) — both round-trip like any other field/text; `invi-commit` turns
61
+ `req[]` into `refs REQ-###` body lines so the trailer encoder picks the ids up (§7.4).
62
+
63
+ ### Task directory
64
+
65
+ Everything about one task lives in `.invictus/tasks/<id>/`:
66
+
67
+ ```
68
+ .invictus/tasks/<id>/
69
+ ├── task.json # canonical task JSON (normalized source of truth for the task)
70
+ ├── plan.md # execution plan, written by invi-task
71
+ ├── qa.md # QA verdict report, written by invi-qa
72
+ └── state.json # DERIVED convenience view of the pipeline state (see §3)
73
+ ```
74
+
75
+ `task.json` and the event-log gate events (§4) are authoritative; `state.json` and the markdown files are
76
+ working artifacts. Per D-005, nothing under `.invictus/log/` or `.invictus/journal/` is ever written by hand.
77
+
78
+ The `invi task` verbs own this directory: `task create --file <path> | --stdin` validates the
79
+ canonical JSON above (zod), writes `task.json` + the initial `state.json`, appends the `task.event`
80
+ (created) and prints the id; `task state <id> <new-state>` enforces the §3 machine; `task list` /
81
+ `task show <id>` render the views (`--json` everywhere). Skills write `task.json` directly only when the
82
+ CLI is unavailable — and say so. `plan.md` is scaffolded/linted by `invi plan` (§8.2) and `qa.md`
83
+ is cross-checked by `invi verify` (§8.4).
84
+
85
+ ---
86
+
87
+ ## 2. Pipeline
88
+
89
+ ```
90
+ task source ──▶ invi-task ──▶ implement ──▶ GATE 1 ──▶ GATE 2 ──▶ GATE 3 ──▶ GATE 4 ──▶ invi-commit ──▶ invi-pr ──▶ 🚦 HUMAN MERGE
91
+ (paste/file/ branch + (stack security tests review QA conventional push +
92
+ tracker/JSON) plan agents) + trailer PR
93
+ ```
94
+
95
+ Gates run in **exactly this order**: security → tests → review → QA. Each gate failure triggers a bounded
96
+ fix loop (max 2 per gate: fix via the stack agents, re-run the same gate). Exhausted loops ⇒ state
97
+ `blocked` + precise report + gate event; the pipeline stops. The orchestrator (`invi-mode`) drives the
98
+ whole sequence; each skill also works standalone.
99
+
100
+ Why security first: findings there invalidate everything downstream and are the cheapest to fix before
101
+ tests/review/QA have been spent on a doomed diff.
102
+
103
+ ### Advisors (outside the gate chain)
104
+
105
+ The four gates above are the whole gate chain — `GATE_NAMES` in `tasks.ts` is `security | tests | review
106
+ | qa` and `invi gate` refuses anything else. Some universal agents are **advisors**, not gates: they are
107
+ summoned during `implement`, they produce a recommendation rather than a verdict, and no task state
108
+ depends on them.
109
+
110
+ | Advisor | Summoned when | Never |
111
+ |---|---|---|
112
+ | `invi-ui` | the task is **explicitly** about design, UI or UX — a new or reworked screen, a design system or token set, layout, styling, motion | on every diff; as a merge condition; on a backend task that grazes a template |
113
+
114
+ An advisor emits no gate event and never moves the state machine. Do not add one to the diagram above,
115
+ and do not invent a gate name for it — `invi gate ui <id>` throws `unknownGate` by design.
116
+
117
+ ### Diff range convention
118
+
119
+ Every gate examines the full branch delta against the manifest base branch:
120
+
121
+ - committed work: `git diff <baseBranch>...HEAD`
122
+ - uncommitted work: `git diff HEAD` (+ `git status --short`)
123
+
124
+ Gates MUST look at both — in this pipeline, commits land *after* the gates (`invi-commit` is post-QA), so
125
+ most of the delta is usually uncommitted.
126
+
127
+ ---
128
+
129
+ ## 3. State machine
130
+
131
+ ```
132
+ open ──▶ in_progress ──▶ security_ok ──▶ tests_ok ──▶ review_ok ──▶ qa_ok ──▶ pr_open ──▶ done
133
+ │ │ │ │ │ │
134
+ └───────────────┴──────────────┴─────────────┴───────────┴──────────┴──▶ blocked
135
+ │
136
+ (human unblocks) ─────┘──▶ in_progress
137
+ ```
138
+
139
+ | State | Entered when | Set by |
140
+ |---|---|---|
141
+ | `open` | task normalized, `task.json` written | invi-task |
142
+ | `in_progress` | branch created, plan written, implementation running | invi-task / orchestrator |
143
+ | `security_ok` | GATE 1 verdict `APPROVE` | orchestrator |
144
+ | `tests_ok` | GATE 2 verdict `PASS` (or `NOT_VERIFIED` explicitly accepted by the user) | orchestrator |
145
+ | `review_ok` | GATE 3 verdict `APPROVE` or `WITH_RESERVATIONS` (reservations recorded in the plan) | orchestrator |
146
+ | `qa_ok` | GATE 4 verdict `APPROVE` or `WITH_RESERVATIONS` | orchestrator |
147
+ | `pr_open` | PR created (or compare URL handed off) | invi-pr / orchestrator |
148
+ | `done` | PR merged — **by a human, always**; recorded after the fact | human / platform |
149
+ | `blocked` | a gate failed after 2 fix loops, or an unresolvable blocker (dirty protected branch, missing config the user can't supply, etc.) | any skill / orchestrator |
150
+
151
+ Transitions not in the table are illegal. A gate that fails within its fix-loop budget does NOT change
152
+ state — the state advances only on pass, or moves to `blocked` on exhaustion. `blocked → in_progress` is a
153
+ human decision (resume after unblocking).
154
+
155
+ This machine is enforced in code: `invi task state <id> <new-state>` performs ONLY the transitions
156
+ above (illegal jumps are refused with a non-zero exit and the legal options named), appends the transition
157
+ to the event log, and keeps `task.json`/`state.json` in sync; a passing `invi gate` (§4) performs the
158
+ corresponding `*_ok` advancement itself.
159
+
160
+ `state.json` (derived view, safe to regenerate):
161
+
162
+ ```jsonc
163
+ {
164
+ "id": "tk4242",
165
+ "state": "tests_ok",
166
+ "history": [
167
+ { "state": "open", "at": "2026-07-09T12:00:00Z" },
168
+ { "state": "in_progress", "at": "2026-07-09T12:03:00Z" },
169
+ { "state": "security_ok", "at": "2026-07-09T12:41:00Z" },
170
+ { "state": "tests_ok", "at": "2026-07-09T13:02:00Z" }
171
+ ]
172
+ }
173
+ ```
174
+
175
+ ---
176
+
177
+ ## 4. Gate events in the event log
178
+
179
+ Every gate outcome — pass, fail, or blocked — is appended to the append-only event log
180
+ (`.invictus/log/<devId>.jsonl`, ARCHITECTURE §5) as a `gate` event. This is the observability seam: the
181
+ platform reads gate outcomes from synced events, and the commit trailer chain anchors them in git history.
182
+
183
+ Payload (`data`) — metrics, never content (no finding text, no code, no prose):
184
+
185
+ ```jsonc
186
+ {
187
+ "task": "tk4242", // ticket id (join key)
188
+ "gate": "security", // security | tests | review | qa
189
+ "verdict": "pass", // pass | pass-with-reservations | fail
190
+ "loop": 0, // attempt number: 0 = first run, 1–2 = after fix loops
191
+ "findings": { "blocker": 0, "high": 0, "medium": 1, "low": 2 }, // optional (security/review)
192
+ "criteria_ok": "5/6", // optional (qa)
193
+ "not_verified": false // optional: true when the environment could not run the check
194
+ }
195
+ ```
196
+
197
+ ### How to append (degradation ladder)
198
+
199
+ Never fail the pipeline over telemetry — and never fake it. Walk down the ladder; use the FIRST rung
200
+ that works:
201
+
202
+ **Rung 1 — the `invi gate` verb (preferred).** First-class since the phase-3 kit: it appends the
203
+ hash-chained `gate` event through the same core writer and advances the task state machine (§3) on a
204
+ passing verdict — `security → security_ok`, `tests → tests_ok`, `review → review_ok`, `qa → qa_ok`,
205
+ in §2 order only:
206
+
207
+ ```
208
+ invi gate <security|tests|review|qa> <task-id> --verdict pass|pass-with-reservations|fail \
209
+ [--loop <n>] [--details '{"findings":{"blocker":0,"high":0,"medium":1,"low":2}}']
210
+ ```
211
+
212
+ `test` is accepted as an alias of `tests`. `--details` takes ONLY the payload extras above (`findings`,
213
+ `criteria_ok`, `not_verified`) — unknown keys are refused, so content can never ride into the log. On
214
+ `fail` the event is appended and the state stays put (§3: state advances only on pass); moving to
215
+ `blocked` after an exhausted fix-loop budget is the orchestrator's explicit call via
216
+ `invi task state <id> blocked`. A gate run out of §2 order records the event but refuses to advance
217
+ and exits non-zero.
218
+
219
+ **Rung 2 — the node snippet** (the `invi` CLI is unavailable or predates the verb): append via
220
+ `@invictus-group-ai/core` (`appendEvent` — the same envelope/hash-chain builder the CLI uses).
221
+ `@invictus-group-ai/core` is ESM; use `node --input-type=module`. This exact snippet is fixture-tested:
222
+
223
+ ```bash
224
+ GATE_EVENT='{"task":"tk4242","gate":"security","verdict":"pass","loop":0,"findings":{"blocker":0,"high":0,"medium":1,"low":2}}' \
225
+ node --input-type=module -e '
226
+ import { appendEvent, defaultLogDir, readManifest, hashGitEmail } from "@invictus-group-ai/core";
227
+ import { execFileSync } from "node:child_process";
228
+ const root = process.cwd();
229
+ const m = readManifest(root);
230
+ const email = execFileSync("git", ["config", "user.email"], { cwd: root }).toString().trim();
231
+ const dev = m.devs.find((d) => d.gitEmailHash === hashGitEmail(email)) ?? m.devs[0];
232
+ if (!dev) { console.error("no dev identity in manifest — run invi init first"); process.exit(1); }
233
+ const e = appendEvent(defaultLogDir(root), dev.id, {
234
+ sid: process.env.CLAUDE_SESSION_ID ?? "orchestrator",
235
+ type: "gate",
236
+ data: JSON.parse(process.env.GATE_EVENT),
237
+ });
238
+ console.log(e.h);
239
+ '
240
+ ```
241
+
242
+ **Rung 3 — journal note** (core not resolvable either):
243
+ `invi journal note -m "gate task=<id> gate=<name> verdict=<v> loop=<n>" --ticket <id>` (sanctioned writer).
244
+
245
+ **Rung 4 — declare it.** None of the above available: state plainly in the final report that gate events
246
+ were NOT logged (`EVENTS_LOGGED: none (<reason>)`).
247
+
248
+ Skills reference this section, so only this spec needs updating when the ladder changes.
249
+
250
+ ---
251
+
252
+ ## 5. Output-block grammar (`INVICTUS-RESULT`)
253
+
254
+ Every pipeline skill ends its reply with exactly one result block — the machine seam that makes skills
255
+ composable by the orchestrator and ingestible by the platform.
256
+
257
+ ### Grammar
258
+
259
+ - A result block is a fenced code block whose info string is exactly `INVICTUS-RESULT`
260
+ (i.e. ` ```INVICTUS-RESULT ` … ` ``` `).
261
+ - Inside: one `KEY: value` pair per line. Nothing else — no blank lines, no comments, no prose.
262
+ - `KEY` matches `[A-Z][A-Z0-9_]*`. Separator is a colon followed by exactly one space (`: `).
263
+ - The **first line is always `BLOCK: <TYPE>`**, `<TYPE>` ∈
264
+ `TASK | SECURITY | TEST | REVIEW | QA | COMMIT | PR | ORCHESTRATION`.
265
+ Extension families follow the same grammar and are defined where their producers live: the `PO-*`
266
+ types (§7.5) and the agent-level `BUILD` (`content/agents/README.md`). Parsers ignore unknown block
267
+ types.
268
+ - `value` is a single line, trimmed. Not-applicable / empty ⇒ `-` (never omit a required key).
269
+ - **List values**: comma+space separated (`a, b, c`); empty list ⇒ `-`.
270
+ - **Map values**: space-separated `key=value` pairs (`security=pass tests=fail`); keys lowercase.
271
+ - **Repeatable keys**: only where a block spec says "repeatable" (e.g. `COMMIT` in `ORCHESTRATION`);
272
+ repeated lines preserve order.
273
+ - Producers MUST emit every required key; parsers MUST ignore unknown keys (forward compatibility).
274
+ - Exactly one block per skill invocation, as the last element of the reply. Human prose goes above the
275
+ block, never inside it.
276
+ - Machine values (verdicts, states, gate names) are EN regardless of the conversation language.
277
+
278
+ Parse rule (reference): `^([A-Z][A-Z0-9_]*): (.*)$` per line; anything that doesn't match invalidates the block.
279
+
280
+ ### Block specs
281
+
282
+ **TASK** (from `invi-task`)
283
+
284
+ | Key | Value |
285
+ |---|---|
286
+ | `BLOCK` | `TASK` |
287
+ | `TASK` | ticket id |
288
+ | `TYPE` | conventional type |
289
+ | `TITLE` | task title (single line) |
290
+ | `BRANCH` | `<type>/<ticket>-<slug>` |
291
+ | `MODULE` | module/scope slug or `-` |
292
+ | `ID_SOURCE` | `provided \| generated` |
293
+ | `TASK_JSON` | `.invictus/tasks/<id>/task.json` |
294
+ | `PLAN` | `.invictus/tasks/<id>/plan.md` |
295
+ | `CRITERIA` | number of acceptance criteria |
296
+ | `RISK_CRITERION` | `present \| added \| n/a` |
297
+ | `TARGET_FILES` | list of probable files or `-` |
298
+ | `NEXT` | one-line recommended next step |
299
+
300
+ **SECURITY** (from `invi-security`)
301
+
302
+ | Key | Value |
303
+ |---|---|
304
+ | `BLOCK` | `SECURITY` |
305
+ | `TASK` | ticket id or `-` |
306
+ | `RANGE` | diff range examined (e.g. `main...HEAD + worktree`) |
307
+ | `VERDICT` | `APPROVE \| BLOCK` |
308
+ | `FINDINGS` | map `blocker=n high=n medium=n low=n` |
309
+ | `AUTO_FIXED` | count of consented mechanical fixes or `-` |
310
+ | `NOT_VERIFIED` | list of checks the environment couldn't run or `-` |
311
+ | `LOOP` | attempt number (0 first run) |
312
+ | `NEXT` | one line |
313
+
314
+ **TEST** (from `invi-test`)
315
+
316
+ | Key | Value |
317
+ |---|---|
318
+ | `BLOCK` | `TEST` |
319
+ | `TASK` | ticket id or `-` |
320
+ | `WORKSPACES` | list of touched manifest workspaces |
321
+ | `TESTS_CREATED` | count of new/updated test files |
322
+ | `SCAFFOLDING` | `existing \| created \| -` |
323
+ | `TESTS_RUN` | map `<ws>=pass\|fail\|not-verified` |
324
+ | `UNCOVERED` | count of known uncovered scenarios or `-` |
325
+ | `VERDICT` | `PASS \| FAIL \| NOT_VERIFIED` |
326
+ | `LOOP` | attempt number |
327
+ | `NEXT` | one line |
328
+
329
+ **REVIEW** (from `invi-review`)
330
+
331
+ | Key | Value |
332
+ |---|---|
333
+ | `BLOCK` | `REVIEW` |
334
+ | `TASK` | ticket id or `-` |
335
+ | `RANGE` | diff range examined |
336
+ | `VERDICT` | `APPROVE \| WITH_RESERVATIONS \| BLOCK` |
337
+ | `FINDINGS` | map `blocker=n high=n medium=n low=n` |
338
+ | `MUST_FIX` | count of items required before PR |
339
+ | `AUTO_FIXED` | count or `-` |
340
+ | `LOOP` | attempt number |
341
+ | `NEXT` | one line |
342
+
343
+ **QA** (from `invi-qa`)
344
+
345
+ | Key | Value |
346
+ |---|---|
347
+ | `BLOCK` | `QA` |
348
+ | `TASK` | ticket id |
349
+ | `VERDICT` | `APPROVE \| WITH_RESERVATIONS \| REJECT` |
350
+ | `CRITERIA_OK` | `n/total` |
351
+ | `BUGS` | count |
352
+ | `RISK_CASE` | `pass \| fail \| not-verified \| n/a` |
353
+ | `NOT_VERIFIED` | list or `-` |
354
+ | `REPORT` | `.invictus/tasks/<id>/qa.md` |
355
+ | `LOOP` | attempt number |
356
+ | `NEXT` | one line |
357
+
358
+ **COMMIT** (from `invi-commit`)
359
+
360
+ | Key | Value |
361
+ |---|---|
362
+ | `BLOCK` | `COMMIT` |
363
+ | `TASK` | ticket id |
364
+ | `BRANCH` | branch name |
365
+ | `COMMIT` | `<short-sha> <subject>` — repeatable, one line per commit made |
366
+ | `GUARDS` | map `secrets=pass generated=pass lint=pass\|warn\|fail\|not-verified` |
367
+ | `WARNINGS` | count of non-blocking warnings |
368
+ | `NEXT` | one line |
369
+
370
+ **PR** (from `invi-pr`)
371
+
372
+ | Key | Value |
373
+ |---|---|
374
+ | `BLOCK` | `PR` |
375
+ | `TASK` | ticket id |
376
+ | `BRANCH` | branch name |
377
+ | `PR` | PR URL, or `-` when `gh` unavailable |
378
+ | `COMPARE_URL` | compare URL built from the origin remote, or `-` |
379
+ | `CI` | `triggered \| unknown \| -` |
380
+ | `MISSING_FOR_MERGE` | list (e.g. `human-review, ci-green`) — merge is always human, so never `-` while open |
381
+ | `NEXT` | one line |
382
+
383
+ **ORCHESTRATION** (from `invi-mode`)
384
+
385
+ | Key | Value |
386
+ |---|---|
387
+ | `BLOCK` | `ORCHESTRATION` |
388
+ | `TASK` | ticket id |
389
+ | `BRANCH` | branch name or `-` |
390
+ | `STATE` | final state-machine state (§3) |
391
+ | `GATES` | map `security=pass\|fail\|skipped tests=… review=… qa=…` (`pass-with-reservations` allowed) |
392
+ | `LOOPS` | map `security=n tests=n review=n qa=n` (fix loops consumed) |
393
+ | `COMMIT` | `<short-sha> <subject>` — repeatable, or single `-` line |
394
+ | `PR` | URL or `-` |
395
+ | `EVENTS_LOGGED` | count of gate events appended, or `none (<reason>)` |
396
+ | `BLOCKED_BY` | one-line reason or `-` |
397
+ | `NEXT` | one line — for `pr_open` always the human-merge handoff |
398
+
399
+ ### Example
400
+
401
+ ```INVICTUS-RESULT
402
+ BLOCK: ORCHESTRATION
403
+ TASK: tk4242
404
+ BRANCH: feat/tk4242-validate-duplicate-cpf
405
+ STATE: pr_open
406
+ GATES: security=pass tests=pass review=pass-with-reservations qa=pass
407
+ LOOPS: security=0 tests=1 review=0 qa=0
408
+ COMMIT: a1b2c3d feat(membership): validate duplicate CPF on registration [tk4242]
409
+ PR: https://github.com/acme/app/pull/128
410
+ EVENTS_LOGGED: 5
411
+ BLOCKED_BY: -
412
+ NEXT: human review + merge — CI green, review and QA approved; merge is a human decision
413
+ ```
414
+
415
+ ---
416
+
417
+ ## 6. Configuration contract
418
+
419
+ Every pipeline skill reads `.invictus/manifest.json` and uses ONLY these fields for project specifics:
420
+
421
+ | Manifest field | Used by | For |
422
+ |---|---|---|
423
+ | `project.baseBranch` | all | diff range, branch base, PR base |
424
+ | `project.protectedBranches` | invi-task, invi-commit, invi-pr | refuse commit/push on protected branches |
425
+ | `project.ticketPattern` | invi-task, invi-commit, invi-qa, invi-mode | id validation + extraction from branch names |
426
+ | `project.catastrophicRisk` | invi-task, invi-security, invi-review, invi-qa | risk criterion + #1 BLOCKER ladder item + mandatory QA case |
427
+ | `project.workspaces.<ws>.{test,build,lint}` | invi-test, invi-qa, invi-commit | the real commands — never invented |
428
+ | `language.render` | all | conversation + client-facing prose language |
429
+ | `devs[]` | invi-mode | gate-event identity (via `gitEmailHash`) |
430
+
431
+ Degradation is uniform: manifest missing ⇒ stop and point to `invi init`; a needed field missing ⇒ ask
432
+ the user — **never guess silently**. Headless with a missing field ⇒ `blocked` with the missing field named.
433
+
434
+ ---
435
+
436
+ ## 7. PO layer (requirements)
437
+
438
+ The requirements pack (`content/skills/po-intake|po-spec|po-lint|po-handoff|po-verify|po-status`) sits
439
+ upstream of the pipeline: the PO's need becomes EARS-linted `REQ-###.md` files whose ids flow through the
440
+ task JSON into every commit trailer — making cost-per-requirement the platform's flagship metric
441
+ (`docs/PLATFORM-API.md`, per-REQ rollup). Design synthesis (EARS + Kiro specs + spec-kit constitution +
442
+ BMAD intake): internal observability design §1.5, §4.
443
+
444
+ ```
445
+ need ──▶ po-intake ──▶ po-spec ──▶ po-lint ──▶ 🚦 PO APPROVAL ──▶ po-handoff ──▶ [pipeline §2] ──▶ po-verify ──▶ delivered
446
+ (brief) (REQ draft) (EARS gate) (human, always) (task JSON) (invi-task → PR) (UAT per AC)
447
+ ```
448
+
449
+ ### 7.1 Artifacts
450
+
451
+ Everything lives in `.invictus/requirements/` (client repo):
452
+
453
+ ```
454
+ .invictus/requirements/
455
+ ├── constitution.md # standing constraints + glossary — seeded at init with the catastrophic risk
456
+ ├── REQ-104.md # one requirement (format: content/templates/requirements/REQ-TEMPLATE.md)
457
+ ├── briefs/ # po-intake output
458
+ └── uat/ # po-verify reports (latest run per REQ; history is the event log)
459
+ ```
460
+
461
+ IDs: `REQ-<number>` (3-digit padded, monotonically assigned, never reused/renumbered — the trailer encoder
462
+ greps `REQ-\d+`); criteria `AC-<req>.<n>` (stable after approval; withdrawn, never renumbered). Criteria
463
+ may be written in EN or pt-BR — the EARS structure and the machine artifacts (ids, front-matter keys,
464
+ status values) are what's fixed. Templates: `content/templates/requirements/REQ-TEMPLATE.md` +
465
+ `constitution-TEMPLATE.md`. As of phase 5, `invi init` installs the templates to
466
+ `.invictus/templates/requirements/` and renders `constitution.md` seeded with
467
+ `manifest.project.catastrophicRisk` (`invi update` refreshes the templates); on a pre-phase-5
468
+ install po-spec still seeds the constitution on first use.
469
+
470
+ ### 7.2 REQ lifecycle
471
+
472
+ ```
473
+ draft ──▶ approved ──▶ in_progress ──▶ delivered
474
+ ▲ │ ▲ │
475
+ └───────────┘ └── reopened ──┘
476
+ (lint FAIL → rework) (defect found)
477
+ ```
478
+
479
+ | Status | Entered when | Set by |
480
+ |---|---|---|
481
+ | `draft` | po-spec writes the file | po-spec |
482
+ | `approved` | po-lint `PASS` **and** the PO's explicit approval — approval is ALWAYS human, the PO-layer twin of the merge gate | po-handoff (records the decision via `invi req approve <id> --confirmed`) |
483
+ | `in_progress` | handoff task(s) minted, `req.event` `handoff` logged | po-handoff |
484
+ | `delivered` | every AC passed UAT (`req.event` `delivered`) | po-verify |
485
+ | `delivered → in_progress` | defect found post-delivery (`req.event` `reopened`), fix task handed off | po-handoff |
486
+
487
+ Transitions not in the table are illegal. Lint failures never change status — a draft stays draft through
488
+ any number of lint/fix cycles (bounded: 2 per run, the standard fix-loop budget).
489
+
490
+ This lifecycle is enforced in code: `invi req` (§7.3 rung 1, §8.1) performs ONLY the transitions
491
+ above — illegal jumps are refused with a non-zero exit and the legal source statuses named, and the
492
+ approval transition additionally requires the explicit `--confirmed` human-decision flag.
493
+
494
+ ### 7.3 `req.event` in the event log
495
+
496
+ Every lifecycle transition and every UAT verdict is appended to the append-only event log as a
497
+ `req.event` (first-class core event type, ARCHITECTURE §5) — the seam the platform joins with commit
498
+ trailers for the per-REQ rollup. Payload (`data`) — metrics, never content (no criterion text, no failure
499
+ narrative):
500
+
501
+ ```jsonc
502
+ {
503
+ "req": "REQ-104", // requirement id (join key)
504
+ "event": "approved | handoff | ac_result | delivered | reopened",
505
+ "ac": "AC-104.2", // ac_result only
506
+ "verdict": "pass | fail | not-verified", // ac_result only
507
+ "task": "tk4242", // handoff/reopened: the task id minted
508
+ "criteria_ok": "6/6" // delivered only
509
+ }
510
+ ```
511
+
512
+ ### How to append (degradation ladder)
513
+
514
+ Same discipline as §4 — walk down, use the FIRST rung that works, never fake and never silently skip:
515
+
516
+ **Rung 1 — the `invi req` verb (preferred).** First-class since the phase-4 kit (§8.1), same shape
517
+ as `invi gate`: it appends the hash-chained `req.event` through the same core writer AND performs the
518
+ matching §7.2 status transition on the REQ file:
519
+
520
+ ```
521
+ invi req approve <id> --confirmed # draft → approved (the flag IS the recorded human decision)
522
+ invi req event <id> --event handoff --task <task-id>
523
+ invi req event <id> --event ac_result --ac AC-104.2 --verdict pass|fail|not-verified
524
+ invi req event <id> --event delivered --criteria-ok 6/6
525
+ invi req event <id> --event reopened --task <task-id>
526
+ ```
527
+
528
+ The payload extras are validated strictly (zod, per event kind) — only the §7.3 fields above are
529
+ accepted, so content can never ride into the log. Lifecycle-illegal events (§7.2) are refused with the
530
+ legal source statuses named; `--event approved` is refused too — approval only goes through
531
+ `req approve --confirmed`.
532
+
533
+ **Rung 2 — the node snippet** (CLI unavailable or predates the verb): reuses the exact §4 rung-2 snippet
534
+ pattern with three substitutions — env var `REQ_EVENT` carrying the payload above, `type: "req.event"`
535
+ in the `appendEvent` call, and sid fallback `"po-layer"` (full snippet inlined in
536
+ `po-handoff`/`po-verify` SKILL.md, which must stay identical to §4's node program apart from those three
537
+ lines). Rung 2 does NOT touch the REQ front-matter — pair it with a hand edit of the `status:` line and
538
+ say so. **Rung 3:** core not resolvable → `invi journal note -m "req.event req=<id> …"`. **Rung 4:**
539
+ neither → say plainly that req events were not logged. Telemetry failure never blocks the PO flow.
540
+
541
+ ### 7.4 How REQ ids reach the platform (the traceability chain)
542
+
543
+ 1. **REQ → task:** `po-handoff` writes the canonical task JSON (§1) with `req: ["REQ-104"]` and each
544
+ mapped criterion prefixed `"[AC-104.1] …"` (verbatim text, never paraphrased). Both survive `invi-task`
545
+ normalization (§1 round-trip rule).
546
+ 2. **Task → commit:** `invi-commit` reads `req[]` from `.invictus/tasks/<id>/task.json` and adds
547
+ `refs REQ-104` to the commit body; the `prepare-commit-msg` hook extracts `REQ-\d+` from the full
548
+ message (deduped, ≤32) into the trailer payload `req[]` (ARCHITECTURE §6).
549
+ 3. **Commit → platform:** trailers are ingested by `POST /v1/ingest/trailers`, `req.event` entries ride
550
+ `invi sync` → `POST /v1/ingest/events`; the platform joins both on the REQ id →
551
+ `GET /v1/report/summary?groupBy=req`: cost, tokens, commits, first/last activity, AC pass rate per
552
+ requirement (`docs/PLATFORM-API.md`).
553
+
554
+ Local preview of the same join: `po-status` decodes the trailers in local history
555
+ (`@invictus-group-ai/core.decodeTrailer` — unverified locally; the synced platform figure is authoritative).
556
+
557
+ ### 7.5 PO block specs (`INVICTUS-RESULT` extension family)
558
+
559
+ Same grammar as §5; `BLOCK` types `PO-INTAKE | PO-SPEC | PO-LINT | PO-HANDOFF | PO-VERIFY | PO-STATUS`.
560
+ AC ids appear lowercased in map keys (`ac-104.1=…`), REQ ids as `req-104=…` — map keys are lowercase by
561
+ grammar; the canonical uppercase ids live in list/scalar values.
562
+
563
+ **PO-INTAKE** (from `po-intake`)
564
+
565
+ | Key | Value |
566
+ |---|---|
567
+ | `BLOCK` | `PO-INTAKE` |
568
+ | `BRIEF` | `.invictus/requirements/briefs/<yyyymmdd>-<slug>.md` |
569
+ | `TOPIC` | one line |
570
+ | `AMBIGUITY` | map `actor=low\|medium\|high trigger=… outcome=… failure=… scope=… thresholds=… measure=…` |
571
+ | `OPEN_QUESTIONS` | count |
572
+ | `ROUNDS` | interview rounds used |
573
+ | `EXISTING_REQ` | overlapping REQ ids or `-` |
574
+ | `NEXT` | one line |
575
+
576
+ **PO-SPEC** (from `po-spec`)
577
+
578
+ | Key | Value |
579
+ |---|---|
580
+ | `BLOCK` | `PO-SPEC` |
581
+ | `BRIEF` | source brief path or `-` |
582
+ | `REQS` | list of REQ ids written |
583
+ | `FILES` | list of file paths |
584
+ | `CRITERIA` | map `req-104=6 req-105=3` |
585
+ | `GLOSSARY_ADDS` | count of constitution glossary terms added or `-` |
586
+ | `OPEN_QUESTIONS` | count |
587
+ | `STATUS` | `draft` |
588
+ | `NEXT` | one line |
589
+
590
+ **PO-LINT** (from `po-lint`) — the mechanical EARS gate; per-AC verdicts
591
+
592
+ | Key | Value |
593
+ |---|---|
594
+ | `BLOCK` | `PO-LINT` |
595
+ | `REQ` | REQ id |
596
+ | `FILE` | `.invictus/requirements/<id>.md` |
597
+ | `VERDICT` | `PASS \| FAIL` |
598
+ | `CRITERIA` | count |
599
+ | `AC_VERDICTS` | map, one entry per AC: `pass` or the worst finding code — `not-ears \| vague-adverb \| no-failure-twin \| compound \| untestable \| undefined-term` (e.g. `ac-104.1=pass ac-104.2=vague-adverb`) |
600
+ | `STRUCTURE` | `ok` or list of failing structure codes (`s1`–`s6`, `constitution-conflict`) |
601
+ | `WARNINGS` | count of non-blocking findings |
602
+ | `OPEN_QUESTIONS` | count |
603
+ | `NEXT` | one line |
604
+
605
+ **PO-HANDOFF** (from `po-handoff`)
606
+
607
+ | Key | Value |
608
+ |---|---|
609
+ | `BLOCK` | `PO-HANDOFF` |
610
+ | `REQ` | REQ id |
611
+ | `STATUS` | `in_progress` |
612
+ | `TASKS` | list of task ids minted |
613
+ | `TASK_JSON` | list of `.invictus/tasks/<id>/task.json` paths |
614
+ | `AC_COVERAGE` | `n/n` — ACs mapped into tasks / total ACs (must be total/total) |
615
+ | `ID_SOURCE` | `provided \| generated` |
616
+ | `EVENTS_LOGGED` | count or `none (<reason>)` |
617
+ | `NEXT` | one line — normally `/invi-mode <task id>` |
618
+
619
+ **PO-VERIFY** (from `po-verify`) — one UAT scenario per AC; verdicts are the PO's
620
+
621
+ | Key | Value |
622
+ |---|---|
623
+ | `BLOCK` | `PO-VERIFY` |
624
+ | `REQ` | REQ id |
625
+ | `CRITERIA_OK` | `n/total` |
626
+ | `AC_RESULTS` | map, one entry per AC: `ac-104.1=pass\|fail\|not-verified` |
627
+ | `VERDICT` | `ACCEPTED \| REJECTED \| PARTIAL` (all pass / any fail / no fail but not-verified remain) |
628
+ | `STATUS` | REQ status after the run: `delivered \| in_progress` |
629
+ | `REPORT` | `.invictus/requirements/uat/<id>.md` |
630
+ | `EVENTS_LOGGED` | count or `none (<reason>)` |
631
+ | `NEXT` | one line |
632
+
633
+ **PO-STATUS** (from `po-status`)
634
+
635
+ | Key | Value |
636
+ |---|---|
637
+ | `BLOCK` | `PO-STATUS` |
638
+ | `SCOPE` | `all` or REQ id / epic slug |
639
+ | `REQS` | map `draft=n approved=n in_progress=n delivered=n` |
640
+ | `DELIVERED` | REQ id list or `-` |
641
+ | `IN_PROGRESS` | REQ id list or `-` |
642
+ | `BLOCKED_ACS` | AC id list or `-` |
643
+ | `COST_SOURCE` | `local-trailers \| platform \| none` |
644
+ | `COST_USD_CENTS` | map `req-104=187` or `-` |
645
+ | `NEXT` | one line — exactly one recommended action |
646
+
647
+ ### Example
648
+
649
+ ```INVICTUS-RESULT
650
+ BLOCK: PO-VERIFY
651
+ REQ: REQ-104
652
+ CRITERIA_OK: 5/6
653
+ AC_RESULTS: ac-104.1=pass ac-104.2=pass ac-104.3=fail ac-104.4=pass ac-104.5=pass ac-104.6=pass
654
+ VERDICT: REJECTED
655
+ STATUS: in_progress
656
+ REPORT: .invictus/requirements/uat/REQ-104.md
657
+ EVENTS_LOGGED: 6
658
+ NEXT: /po-handoff REQ-104 — fix task for AC-104.3 (duplicate CPF accepted across tenants)
659
+ ```
660
+
661
+ ---
662
+
663
+ ## 8. Orchestration verbs (deterministic scaffolding)
664
+
665
+ Phase-4 verbs (`invi req | plan | run | verify | review | ship` — ARCHITECTURE §8), completing the
666
+ phase-3 `task`/`gate` pair. The dividing line is the tenet "logic in code, judgment in prompts": these
667
+ verbs own the MECHANICS around the pipeline — validation, lint, sizing heuristics, gap detection, git/PR
668
+ plumbing, and the event-log record — while every judgment (writing criteria and plans, reviewing code,
669
+ deciding approval) stays in the skills. Every verb supports `--json`, `-C/--dir`, `--lang`; every
670
+ recorded outcome goes through the same core writer as §4 (hash-chained, metrics never content).
671
+
672
+ Skills call the verbs FIRST and fall back down the §4/§7.3 ladders only when the CLI is unavailable —
673
+ verb first, snippet fallback, journal note, then declare it, exactly as before.
674
+
675
+ ### 8.1 `invi req` — REQ lifecycle
676
+
677
+ The first-class owner of `.invictus/requirements/` mechanics (rung 1 of the §7.3 ladder — full command
678
+ shapes there):
679
+
680
+ - `req create --file <path>` — MECHANICAL validation of a REQ file (the machine floor under `/po-lint`,
681
+ which stays the semantic gate): front-matter present, `id` matches `REQ-<number>`, `status` in the
682
+ §7.2 enum (a new REQ must enter as `draft` — `approved` is never imported), at least one
683
+ `- **AC-<req>.<n>** — …` criterion, AC ids belong to the REQ and are unique. Warnings (never
684
+ blocking): no EARS keyword detected, an event-driven criterion in a REQ with no unwanted-behavior
685
+ criterion and no `(no failure mode: …)` marker (the failure-twin heuristic), missing optional
686
+ front-matter fields, unchecked open questions. Errors block: exit 1 and nothing is written; on
687
+ success the file is installed at `.invictus/requirements/<id>.md` (never overwriting).
688
+ - `req approve <id> --confirmed` — draft → approved + the `approved` req.event. Refused without
689
+ `--confirmed` (approval is ALWAYS human, §7.2), with mechanical errors, or with unchecked open
690
+ questions (template rule).
691
+ - `req event <id> --event …` — the other §7.3 events with strict payloads and §7.2 legality (see §7.3).
692
+ - `req status [--json]` — every REQ with lifecycle status, criteria count, per-AC UAT verdicts from
693
+ `ac_result` events, and the tasks whose `task.json` `req[]` cite it with their state + per-gate
694
+ progress (§4 events) — the local, deterministic slice of what `/po-status` narrates.
695
+
696
+ ### 8.2 `invi plan <task-id>` — plan scaffold + mechanical lint
697
+
698
+ A plan is executable only when every step says exactly WHAT files, WHAT change, HOW to check it ran,
699
+ and WHAT observable outcome ends it — the proven GSD task anatomy. The verb owns that floor:
700
+
701
+ - **Scaffold** — when `.invictus/tasks/<id>/plan.md` is missing, it is created from `task.json`: one
702
+ step per acceptance criterion (capped at 6 — merge, don't pad), each step in the canonical shape
703
+ (labels are EN machine artifacts; the prose inside is written in the render language):
704
+
705
+ ```markdown
706
+ ### S1 — <step title>
707
+ - Files: <exact repo paths, comma-separated>
708
+ - Action: <the smallest coherent change>
709
+ - Verify: `<runnable command>`
710
+ - Done: <observable, measurable outcome>
711
+ ```
712
+
713
+ - **Lint** — every `###` step is checked mechanically; each missing piece is a BLOCKER (exit 1):
714
+
715
+ | Blocker | Meaning |
716
+ |---|---|
717
+ | `no-steps` | no `### S<n> — …` steps at all |
718
+ | `files-missing` / `files-not-exact` | no `- Files:` line / no real path named (placeholders, "somewhere in…") |
719
+ | `action-missing` / `action-empty` | no `- Action:` line / empty or still a `<placeholder>`/TBD |
720
+ | `verify-missing` / `verify-not-runnable` | no `- Verify:` line / not a runnable command |
721
+ | `done-missing` / `done-not-measurable` | no `- Done:` line / measures nothing ("done", "pronto") |
722
+
723
+ - **Record** — the result is appended as a `verify` event, `data.kind = "plan.lint"`, payload
724
+ `{task, verdict, steps, blockers: ["s1:files-not-exact", …]}` — codes and counts only.
725
+
726
+ `invi-task` writes the plan (judgment: which steps, which neighbor pattern) and then runs
727
+ `invi plan <id>` to prove the anatomy; a blocked lint is fixed in the plan, never bypassed.
728
+
729
+ ### 8.3 `invi run <task-id>` — the auto-sizing router
730
+
731
+ **The human never picks the weight class** (ARCHITECTURE §8). The router computes it from deterministic
732
+ signals and ALWAYS states its reasons (localized on screen; stable EN codes in the event):
733
+
734
+ Signals: task `type` + `acceptance_criteria` count + `req[]` from `task.json`; plan presence, lint
735
+ state and step count (§8.2); the task branch (first non-protected branch whose name contains the task
736
+ id) and its §2 branch delta (files + churn, committed + worktree); the fragile-area intersection —
737
+ patterns from the `FRAGILE_PATHS` marked section of `.invictus/codebase/CONCERNS.md` when the codebase
738
+ map exists (`<!-- invictus:var:FRAGILE_PATHS -->`, one path/glob per line), else the default trio
739
+ family (`auth`, `payment`, `billing`, `checkout`, `money`, `migration`) — matched against the branch's
740
+ changed files, or the plan's `Files:` entries when no branch exists yet.
741
+
742
+ Decision matrix (first match wins; thresholds are exported constants, tests and docs share them):
743
+
744
+ | Verdict | Rule | Reasons stated |
745
+ |---|---|---|
746
+ | `full-pipeline` | ANY escalator: fragile intersection · `req[]` non-empty (the gate chain feeds the per-REQ rollup) · type `hotfix` · ≥4 criteria · diff ≥10 files or ≥400 changed lines · plan ≥4 steps | every escalator that fired |
747
+ | `inline` | ALL of: type ∈ `docs\|chore\|style` · ≤2 criteria · diff ≤2 files (or no branch yet) | `light-type`, `few-criteria`, `small-diff`/`no-diff-signal` |
748
+ | `quick` | everything else | `no-full-trigger` + what kept it out of inline |
749
+
750
+ What each verdict means (printed as the next step):
751
+
752
+ - `full-pipeline` → `/invi-mode <id>` — the complete §2 pipeline, four gates, bounded loops.
753
+ - `quick` → `/invi-task <id>`, implement the smallest coherent change, then one condensed gate pass
754
+ (each gate skill once, outcomes logged via `invi gate`), then `/invi-commit` + `/invi-pr`.
755
+ - `inline` → implement directly on a task branch (no subagent ceremony), `invi verify <id>`,
756
+ `/invi-commit`; any gate actually run is still logged via `invi gate`.
757
+
758
+ The decision is recorded as a `decision` event, `data.kind = "run.sizing"`, payload
759
+ `{task, verdict, computed, reasons[], criteria, plan, diff_files, fragile_hits}`. `--force
760
+ <inline|quick|full-pipeline> --reason <text>` overrides: the computed verdict, the override, and the
761
+ reason are all logged (`forced: true`) — an unexplained `--force` is refused. Escalating beyond the
762
+ verdict is always allowed without `--force` (running the full pipeline on an `inline` task wastes
763
+ tokens, never safety); de-escalating REQUIRES it.
764
+
765
+ ### 8.4 `invi verify <task-id>` — deterministic verification support
766
+
767
+ The mechanical half of "is this task actually verified?" — run before commit/ship or whenever honesty
768
+ needs receipts. Three checks, every failure a named GAP, exit 1 while any remain:
769
+
770
+ 1. **Workspace commands** — runs the REAL `project.workspaces.<ws>.{test,build,lint}` commands from the
771
+ manifest (never invented), each in its workspace directory. A failing command is
772
+ `command-failed:<ws>.<kind>`; NO configured commands is itself the gap `no-commands` — absence of
773
+ checks is never a pass.
774
+ 2. **QA record** — `.invictus/tasks/<id>/qa.md` must exist (`qa-md-missing`) and carry at least one
775
+ verdict table row per acceptance criterion (`qa-verdicts-incomplete`). A row counts when any cell
776
+ carries a verdict token — `pass/ok/fail/failed/aprovado/reprovado/falha/falhou/not-verified/não
777
+ verificado/n/a` (EN and pt-BR lexicon fixed here, the machine seam with `/invi-qa`).
778
+ 3. **Gate-event completeness** (§4) — the LATEST verdict of each of the four gates must be `pass` or
779
+ `pass-with-reservations`: never run is `gate-missing:<gate>`, latest-run-failed is
780
+ `gate-failed:<gate>`.
781
+
782
+ The summary is appended as a `verify` event, `data.kind = "task.verify"`, payload
783
+ `{task, commands{}, qa_md, qa_rows, criteria, gates{}, gaps[]}` — statuses and codes only.
784
+
785
+ ### 8.5 `invi review <task-id>` — review-context assembler
786
+
787
+ Read-only (appends nothing): assembles the deterministic context `/invi-review` consumes, so the review
788
+ skill spends its budget on judgment, not plumbing. Printed as one EN `KEY: value` block:
789
+
790
+ ```
791
+ TASK / STATE / BASE / BRANCH # task record + manifest base + detected task branch
792
+ RANGE # §2 range examined (base...branch + worktree, or worktree-only)
793
+ FILES / CHANGED # count (+ins −del) and the changed-file list
794
+ FRAGILE_HITS / FRAGILE_SOURCE # changed files ∩ fragile areas (§8.3 source: concerns-doc | defaults)
795
+ PRIOR_REVIEW # prior review-gate events (loop + verdict), log order
796
+ GATES / PLAN / QA_MD / CRITERIA # §4 latest verdicts · plan lint state · qa.md presence · AC count
797
+ RISK # manifest project.catastrophicRisk (first BLOCKER ladder item)
798
+ ```
799
+
800
+ No branch matching the task id → it degrades to the worktree diff and says so. `/invi-review` treats the
801
+ block as INPUT — the findings, severities, and the verdict remain entirely the skill's.
802
+
803
+ ### 8.6 `invi ship <task-id>` — pre-PR gatekeeper
804
+
805
+ The deterministic core of the eks-pr pattern: **refuse precisely or hand off cleanly.** Preconditions,
806
+ in order — every failure is a named problem, exit 1, nothing shipped:
807
+
808
+ 1. task state is `qa_ok` (§3; `pr_open` re-runs are idempotent) — else `wrong-state`;
809
+ 2. all four gates' LATEST verdict in the event log passes (§4) — else `gates-incomplete` (a late
810
+ re-run that failed counts: the record must be clean NOW, not historically);
811
+ 3. the manifest test commands run green NOW — `tests-failed`, or `tests-not-configured` when no test
812
+ command exists (never asserted from memory);
813
+ 4. the current branch is the task branch and is pushed — it pushes (`git push -u origin <branch>`)
814
+ when needed; `no-branch` / `protected-branch` / `push-failed` otherwise.
815
+
816
+ Then it renders the PR body from `task.json` + plan + gate results — ticket (+ `refs REQ-###` when
817
+ `req[]` is set, §7.4), summary, change type, criteria checklist, per-gate verdicts with loop counts and
818
+ the QA `criteria_ok`, plan steps, and the human checklist — to `.invictus/tasks/<id>/pr-body.md`
819
+ (render language). PR creation: `gh pr create` when `gh` is on PATH; else the compare/MR URL derived
820
+ from the REAL origin remote (GitHub- and GitLab-shaped hosts; a local/unrecognized remote prints manual
821
+ instructions). A failing `gh` never blocks the handoff — the branch is pushed and the body is ready.
822
+ Finally `qa_ok → pr_open` (state machine + `task.event`). **Merge stays ALWAYS human** — the verb ends
823
+ at the §2 handoff, exactly where `/invi-pr` ends.