@jaimevalasek/aioson 1.28.0 → 1.29.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 (94) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/docs/pt/4-agentes/briefing.md +2 -0
  3. package/docs/pt/4-agentes/copywriter.md +2 -0
  4. package/docs/pt/4-agentes/genome.md +1 -0
  5. package/docs/pt/4-agentes/profiler-enricher.md +2 -0
  6. package/docs/pt/4-agentes/profiler-forge.md +2 -0
  7. package/docs/pt/4-agentes/sheldon.md +2 -0
  8. package/docs/pt/4-agentes/squad.md +12 -10
  9. package/docs/pt/5-referencia/comandos-cli.md +2 -0
  10. package/docs/pt/5-referencia/memoria-e-contexto.md +60 -0
  11. package/package.json +1 -1
  12. package/src/cli.js +5 -0
  13. package/src/commands/rules-lint.js +116 -0
  14. package/src/context-selector.js +29 -5
  15. package/template/.aioson/agents/analyst.md +57 -41
  16. package/template/.aioson/agents/architect.md +40 -33
  17. package/template/.aioson/agents/briefing.md +96 -81
  18. package/template/.aioson/agents/copywriter.md +34 -2
  19. package/template/.aioson/agents/discover.md +5 -8
  20. package/template/.aioson/agents/discovery-design-doc.md +42 -35
  21. package/template/.aioson/agents/genome.md +3 -1
  22. package/template/.aioson/agents/orache.md +6 -15
  23. package/template/.aioson/agents/orchestrator.md +38 -31
  24. package/template/.aioson/agents/pm.md +7 -0
  25. package/template/.aioson/agents/product.md +146 -174
  26. package/template/.aioson/agents/profiler-enricher.md +19 -0
  27. package/template/.aioson/agents/profiler-forge.md +6 -0
  28. package/template/.aioson/agents/qa.md +18 -10
  29. package/template/.aioson/agents/scope-check.md +6 -0
  30. package/template/.aioson/agents/sheldon.md +30 -14
  31. package/template/.aioson/agents/site-forge.md +2 -6
  32. package/template/.aioson/agents/squad.md +5 -12
  33. package/template/.aioson/agents/tester.md +29 -23
  34. package/template/.aioson/agents/ux-ui.md +43 -36
  35. package/template/.aioson/agents/validator.md +2 -2
  36. package/template/.aioson/docs/LAYERS.md +2 -0
  37. package/template/.aioson/docs/autonomy-protocol.md +7 -5
  38. package/template/.aioson/docs/autopilot-handoff.md +2 -0
  39. package/template/.aioson/docs/dev/execution-discipline.md +3 -0
  40. package/template/.aioson/docs/dev/simple-plan-lane.md +95 -92
  41. package/template/.aioson/docs/dev/stack-conventions.md +3 -0
  42. package/template/.aioson/docs/deyvin/continuity-recovery.md +21 -18
  43. package/template/.aioson/docs/deyvin/debugging-escalation.md +3 -0
  44. package/template/.aioson/docs/deyvin/pair-execution.md +3 -0
  45. package/template/.aioson/docs/deyvin/runtime-handoffs.md +3 -0
  46. package/template/.aioson/docs/dossier/agent-templates.md +3 -0
  47. package/template/.aioson/docs/dossier/schema.md +3 -0
  48. package/template/.aioson/docs/example-external-api-context.md +2 -0
  49. package/template/.aioson/docs/handoff-persistence.md +96 -94
  50. package/template/.aioson/docs/pentester/app-playbooks.md +3 -0
  51. package/template/.aioson/docs/pentester/browser-dast-playbook.md +401 -398
  52. package/template/.aioson/docs/pentester/llm-supplychain.md +3 -0
  53. package/template/.aioson/docs/quality/code-health-analysis.md +2 -0
  54. package/template/.aioson/docs/sheldon/enrichment-paths.md +3 -0
  55. package/template/.aioson/docs/sheldon/harness-contract.md +3 -0
  56. package/template/.aioson/docs/sheldon/quality-lens.md +3 -0
  57. package/template/.aioson/docs/sheldon/research-loop.md +3 -0
  58. package/template/.aioson/docs/sheldon/web-intelligence.md +3 -0
  59. package/template/.aioson/docs/site-forge-build.md +4 -2
  60. package/template/.aioson/docs/site-forge-extraction.md +2 -0
  61. package/template/.aioson/docs/site-forge-qa.md +2 -0
  62. package/template/.aioson/docs/site-forge-recon.md +7 -5
  63. package/template/.aioson/docs/site-forge-transform.md +2 -0
  64. package/template/.aioson/docs/squad/content-output.md +3 -0
  65. package/template/.aioson/docs/squad/creation-flow.md +22 -1
  66. package/template/.aioson/docs/squad/domain-breadth.md +3 -0
  67. package/template/.aioson/docs/squad/domain-classification.md +3 -0
  68. package/template/.aioson/docs/squad/eval-gate.md +3 -0
  69. package/template/.aioson/docs/squad/genome-bindings.md +14 -0
  70. package/template/.aioson/docs/squad/package-contract.md +5 -0
  71. package/template/.aioson/docs/squad/persona-grounding.md +65 -62
  72. package/template/.aioson/docs/squad/quality-lens.md +3 -0
  73. package/template/.aioson/docs/squad/research-loop.md +3 -0
  74. package/template/.aioson/docs/squad/session-operations.md +3 -0
  75. package/template/.aioson/docs/squad/workflow-quality.md +3 -0
  76. package/template/.aioson/docs/tester/coverage-quality.md +3 -0
  77. package/template/.aioson/rules/README.md +28 -0
  78. package/template/.aioson/rules/agent-language-policy.md +26 -21
  79. package/template/.aioson/rules/agent-structural-contract.md +5 -0
  80. package/template/.aioson/rules/aioson-context-boundary.md +6 -1
  81. package/template/.aioson/rules/canonical-path-contract.md +15 -10
  82. package/template/.aioson/rules/data-format-convention.md +16 -11
  83. package/template/.aioson/rules/disk-first-artifacts.md +10 -6
  84. package/template/.aioson/rules/example-monetary-values.md +4 -0
  85. package/template/.aioson/rules/output-brevity.md +2 -0
  86. package/template/.aioson/rules/prd-section-ownership.md +17 -12
  87. package/template/.aioson/rules/security-baseline.md +4 -0
  88. package/template/.aioson/rules/simple-plan-lane.md +5 -0
  89. package/template/.aioson/rules/spec-level-ownership.md +10 -5
  90. package/template/.aioson/rules/squad-driver-pattern.md +5 -0
  91. package/template/.aioson/tasks/squad-create.md +11 -0
  92. package/template/.aioson/tasks/squad-design.md +3 -3
  93. package/template/AGENTS.md +1 -1
  94. package/template/CLAUDE.md +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.29.1] - 2026-06-12
6
+
7
+ ### Docs
8
+ - **Documented the v1.29.0 selective-context model in the project docs.** New "Carregamento seletivo de contexto" section in `memoria-e-contexto.md` (the two modes, activation fast paths, mid-flow activation guards, selector-routable rules/docs frontmatter, and `rules:lint`); `context:select` and `rules:lint` added to the CLI reference; per-agent notes for squad (investigation opt-out + create-phase genome pass), copywriter (INDEX-driven genome menu + binding operational sections), genome and the profiler pipeline (operational-method layer), and activation fast-path cross-links on briefing/sheldon.
9
+
10
+ ## [1.29.0] - 2026-06-11
11
+
12
+ ### Added
13
+ - **Activation-only fast paths across the entry agents.** `@briefing`, `@product`, `@sheldon`, `@analyst`, and `@copywriter` join `@deyvin`: bare activation loads only foundation context (plus registry frontmatter / filename listings where the agent needs a menu), presents the starting options, and stops. Required inputs are now declared with the step that needs each item — never all upfront. `@product` was compressed to fit the fast path inside its 25KB kernel budget (24,999 bytes).
14
+ - **Activation guards on the mid-flow agents.** `@architect`, `@ux-ui`, `@pm`, `@qa`, `@orchestrator`, `@scope-check`, and `@discovery-design-doc`: activation without a feature slug reads foundation context only, reports the current stage, asks which feature to work on, and stops. `@qa`'s legacy eager loading section (the "design governance" variant) is replaced by `context:select`-backed Context loading modes. `@validator` heading aligned (its strict sandbox semantics were already the tightest loader in the framework).
15
+ - **The eager rules/docs loading section is retired framework-wide.** `@tester`, `@squad`, `@site-forge`, and `@discover` replace "Project rules, docs & design docs" with on-demand Context loading modes; gateways (CLAUDE.md/AGENTS.md) describe rule loading as on-demand; a contract test bans every variant of the eager section in every template agent.
16
+ - **Selector-routable rules and docs.** All template rules carry routing frontmatter (`modes`, `task_types`, `triggers`, `paths`, `load_tier`) — description-only rules were selector-invisible (+20 < threshold 30). 41 template docs (squad, sheldon, dev, deyvin, pentester, tester, dossier, site-forge, governance) gain the same routing fields. `context:select` activation-only mode generalized to all workflow agents (per-agent foundation allowlist).
17
+ - **`aioson rules:lint [--docs] [--strict] [--json]`** — flags selector-invisible rules (and docs with `--docs`), missing required fields, and suggests routing metadata. `--strict` exits 1 on warnings for CI. Template ships 67/67 selector-visible files, locked by test.
18
+ - **Squad creation: investigation is opt-out and genomes enter the loop.** Tier-2 domains run `@orache` by default; tier-3 with no sourceDocs gets an announced Quick Scan. New `squad-create` Step 5.5 (genome pass): planned genomes are reused or generated via `@genome` and bound (manifest `genomes`+`genomeBindings`, executor `## Active genomes`, `squad.md`); pending bindings are queued with `status: pending` and surfaced — never silently empty.
19
+ - **Operational-method layer in the persona pipeline.** Benchmarked against practitioner source prompts (Stefan Georgi / RMBC): `@profiler-enricher` Module 9 extracts the executable method (procedure, output structure, style metrics, prohibitions, delivery checklist) from evidence; `@profiler-forge` emits it as five required Genome 3.0 sections; `@genome` treats a missing `## Operating Procedure` on function/practitioner-persona genomes as a generation defect; genome-bindings propagate Prohibitions → executor Hard constraints, Delivery Checklist → squad checklists, Operating Procedure → Response pattern.
20
+ - **`@copywriter` genome menu via `INDEX.md`.** New Step G2.4 discovers all installed genomes (masters, personas, domain, brand-voice) through `.aioson/genomes/INDEX.md` with its audience/output-type selection guides; the hardcoded master list becomes the index-absent fallback. The menu serves marketing pages, content, site copy, and system/UI microcopy. Operational sections of a selected genome are binding for the piece (procedure, prohibitions, style metrics, delivery checklist).
21
+
22
+ ### Changed
23
+ - `@orache` squad rules load by frontmatter match instead of wholesale scan; `@squad` decision-gating and `@sheldon` mining restricted to selected context; `@sheldon` brain index loads after PRD selection instead of on activation.
24
+
25
+ ### Tests
26
+ - Contract suites for every fast path/guard (tokens + section ordering), per-agent activation-only selection, rules/docs routing visibility (67/67), `rules:lint` behavior, squad investigation/genome-pass tokens, operational-method tokens across the pipeline, and copywriter INDEX discovery. Full suite green (3227 pass).
27
+
5
28
  ## [1.28.0] - 2026-06-11
6
29
 
7
30
  ### Added
@@ -70,6 +70,8 @@ Você > Todos.
70
70
  4. `.aioson/context/prd*.md` e `prds/*.md` — evita duplicar trabalho já comprometido.
71
71
  5. Web search quando há premissas que precisam de validação externa.
72
72
 
73
+ > **Fast path de ativação (v1.29.0):** ativar `@briefing` "seco", sem nomear plano ou tarefa, carrega **só** o `project.context.md`, o frontmatter do registro e a *listagem de nomes* de `plans/` — apresenta o menu e para. O conteúdo dos planos e PRDs acima entra só no passo que os usa. Veja [Carregamento seletivo de contexto](../5-referencia/memoria-e-contexto.md#carregamento-seletivo-de-contexto-v1290).
74
+
73
75
  ## Handoff típico
74
76
 
75
77
  - **Vem de:** você, com anotações em `plans/` ou uma ideia conversacional.
@@ -53,6 +53,8 @@ A grande diferença em relação a um "prompt de copy genérico" é que ele tem
53
53
 
54
54
  ## Selecionar a mente do copywriter (genomes)
55
55
 
56
+ > **Menu via INDEX (v1.29.0):** a descoberta de genomes agora lê o `.aioson/genomes/INDEX.md` — o registro de **todos** os genomes instalados (mestres, personas, domínio, brand-voice), com guias de seleção por audiência e por tipo de output. O menu aparece quando você pergunta "quais genomes tenho", na ativação seca, ou quando mais de um genome serve para a peça. Vale para qualquer entrega: páginas de marketing, conteúdo, copy de site e **microcopy de sistema** (botões, empty states, onboarding, mensagens de erro). Quando o genome escolhido tem seções operacionais (geradas pelo pipeline de persona — `## Operating Procedure`, `## Prohibitions`, `## Style Metrics`, `## Delivery Checklist`), elas são **vinculantes** para a peça: o procedimento dirige o fluxo, as proibições viram hard constraints e o checklist roda na validação final.
57
+
56
58
  Quando há múltiplos genomes de mestres instalados, o `@copywriter` pergunta qual perspectiva aplicar. **8 mestres disponíveis** organizados em 2 hemisférios:
57
59
 
58
60
  ### Mestres universais (US, em inglês — adaptam-se ao idioma do projeto)
@@ -105,6 +105,7 @@ aioson system:publish --type=genome --slug=<slug>
105
105
  ## Detalhes recentes
106
106
 
107
107
  - **Genome 4.0 (2026):** novos campos `anchor_prompt`, `relations`, `hexaco_h`, e `trait_interactions` — o genome passou a modelar como traços interagem entre si, não apenas listá-los isoladamente
108
+ - **Camada de método operacional (v1.29.0):** genomes de função e de persona-praticante agora carregam **o que a pessoa FAZ**, não só quem ela é. Cinco seções obrigatórias — `## Operating Procedure` (o método em passos executáveis, ex: RMBC), `## Output Structure`, `## Style Metrics`, `## Prohibitions`, `## Delivery Checklist` — extraídas das evidências pelo pipeline de persona. Um genome de praticante sem `## Operating Procedure` simula opiniões, não trabalho, e é tratado como defeito de geração. Ao vincular num squad, essas seções se propagam: proibições viram hard constraints do executor, o checklist vira checklist do squad, e o procedimento dirige o padrão de resposta.
108
109
 
109
110
  ---
110
111
 
@@ -71,6 +71,8 @@ Você > proceed
71
71
  └── enriched-profile.md ← saída desta etapa
72
72
  ```
73
73
 
74
+ > **Método operacional (v1.29.0):** além do perfil psicométrico (DISC, Big Five, etc.), o enricher extrai das evidências o **método executável** da pessoa — procedimento em passos, estrutura de output, métricas de estilo, proibições e checklist de entrega (a seção `## Operational Method` do perfil). É o que faz o genome simular *o que a pessoa faz*, não só suas opiniões. Quando a fonte não documenta um método passo a passo, ele é reconstruído e marcado `inferred` — nunca inventado.
75
+
74
76
  ---
75
77
 
76
78
  ## Como ele lê seu projeto
@@ -71,6 +71,8 @@ Você > 3
71
71
  .aioson/genomes/{slug}-advisor.md ← advisor como prompt utilizável
72
72
  ```
73
73
 
74
+ > **Seções operacionais (v1.29.0):** o forge emite o método capturado pelo enricher como cinco seções obrigatórias no genome — `## Operating Procedure`, `## Output Structure`, `## Style Metrics`, `## Prohibitions`, `## Delivery Checklist`. Um genome de persona-praticante sem `## Operating Procedure` é tratado como defeito de geração. Veja [genome.md](./genome.md) para como essas seções se propagam ao vincular num squad.
75
+
74
76
  ---
75
77
 
76
78
  ## Como ele lê seu projeto
@@ -80,6 +80,8 @@ O `@sheldon` decide entre **enriquecer in-place** ou **criar plano faseado** dep
80
80
  5. `.aioson/briefings/{slug}/briefings.md` — se `briefing_source` está no PRD.
81
81
  6. `plans/*.md` e `prds/*.md` — fontes de pesquisa pré-produção do usuário.
82
82
 
83
+ > **Fast path de ativação (v1.29.0):** ativar `@sheldon` "seco", sem PRD/slug, carrega **só** o `project.context.md`, a listagem de nomes dos `prd*.md` e a tabela `features.md` — apresenta a lista de PRDs para seleção e para. O conteúdo do PRD e o índice de brains entram só depois da escolha do alvo. Veja [Carregamento seletivo de contexto](../5-referencia/memoria-e-contexto.md#carregamento-seletivo-de-contexto-v1290).
84
+
83
85
  ## Handoff típico
84
86
 
85
87
  - **Vem de:** `@product` (PRD gerado) — pode ser ativado N vezes antes de ir adiante.
@@ -93,16 +93,16 @@ Antes de criar, o `@squad` lê:
93
93
 
94
94
  ## Comandos CLI relacionados
95
95
 
96
- ```bash
97
- # Criar squad via CLI
98
- aioson squad:scaffold . --slug=<slug> --name="Meu Squad" --mode=mixed
99
-
100
- # Diagnosticar squad existente
101
- aioson squad:doctor . --squad=<slug>
102
-
103
- # Publicar no aioson.com
104
- aioson system:publish --type=squad --slug=<slug>
105
- ```
96
+ ```bash
97
+ # Criar squad via CLI
98
+ aioson squad:scaffold . --slug=<slug> --name="Meu Squad" --mode=mixed
99
+
100
+ # Diagnosticar squad existente
101
+ aioson squad:doctor . --squad=<slug>
102
+
103
+ # Publicar no aioson.com
104
+ aioson system:publish --type=squad --slug=<slug>
105
+ ```
106
106
 
107
107
  ---
108
108
 
@@ -117,6 +117,8 @@ aioson system:publish --type=squad --slug=<slug>
117
117
 
118
118
  - **domain breadth (Mai/2026):** executores que antes recusavam pedidos adjacentes ao seu escopo agora respondem com mais amplitude contextual
119
119
  - **squad refresh:** `@squad refresh <slug>` atualiza um squad existente com nova investigação sem recriar do zero
120
+ - **investigação opt-out (v1.29.0):** a investigação de domínio com `@orache` agora roda **por padrão** — completa para domínios regulados/especializados, Quick Scan (1–2 rodadas) para domínios comuns sem fontes. É o que aterra os executores em frameworks/vocabulário reais em vez de priors do modelo (a causa nº1 de executor raso). O `@squad` anuncia o scan em vez de perguntar; diga "pula" para dispensar.
121
+ - **genome pass na criação (v1.29.0):** os genomes planejados por executor são gerados e vinculados **durante** a criação do squad — não mais como passo manual depois. Um squad de domínio especializado nunca sai com `## Active genomes` vazio: ou vincula o genome, ou entrega o comando `@genome` exato pendente no resumo da criação. Para re-aterrar executores rasos de squads antigos, rode `@squad refresh <slug>`.
120
122
 
121
123
  ---
122
124
 
@@ -150,6 +150,8 @@
150
150
  | `skill:list` | Lista skills instaladas em `.aioson/installed-skills/` | Quando quer saber quais skills estão ativas |
151
151
  | `skill:remove` | Remove skill instalada e limpa diretórios de ferramentas | Quando uma skill não é mais necessária |
152
152
  | `compress:agents` | Comprime arquivos de instrução dos agentes para reduzir consumo de tokens por sessão. Modo estrutural (gratuito) ou semântico via LLM (`--llm`). Salva backup automático em `.original.md`. Aceita `--agent`, `--rules`, `--dry-run`, `--restore`. | Quando quer reduzir custo de API sem alterar nenhuma lógica. Veja [compress:agents](./compress-agents.md) |
153
+ | `context:select` | Seleciona sob demanda só as regras/docs/design-docs relevantes para a tarefa atual, por agente e modo (`--mode=planning\|executing`). Aceita `--agent`, `--task`, `--paths`, `--feature`, `--json`. | É o motor por trás dos *fast paths* e *activation guards* — os agentes o invocam para carregar só o que a task exige. Veja [Memória e Contexto](./memoria-e-contexto.md) |
154
+ | `rules:lint` | Acusa regras (e docs, com `--docs`) "invisíveis ao seletor" — sem `task_types`/`triggers`/`paths` e sem `load_tier: always`, que o `context:select` nunca carregaria sob demanda. Aceita `--docs`, `--strict` (sai com código 1 em CI), `--json`. | Depois de criar/editar regras ou docs em `.aioson/rules/` ou `.aioson/docs/` — confirma que o seletor consegue roteá-los. Veja [Memória e Contexto](./memoria-e-contexto.md) |
153
155
  | `design-hybrid:options` | Abre um seletor visual com setas + espaço para montar um preset temporário de variações de design | Quando quer alimentar a `design-hybrid-forge` com direções mais extravagantes, clássicas, animadas ou com CSS avançado. Usa o locale do projeto automaticamente e aceita `--locale` como override; com `--advanced` libera um 3º modificador. Veja [design-hybrid-forge](../4-agentes/design-hybrid-forge.md) |
154
156
 
155
157
  ### Cloud
@@ -260,6 +260,66 @@ Quando a zona é `warning` ou `critical`, um evento é automaticamente registrad
260
260
 
261
261
  ---
262
262
 
263
+ ## Carregamento seletivo de contexto (v1.29.0+)
264
+
265
+ As 3 camadas acima resolvem *onde* a memória mora. Esta seção resolve um problema diferente: *quando* cada arquivo entra na janela de contexto. Antes, ativar um agente carregava de tudo — regras, docs, design-docs, specs — logo de cara, mesmo que a tarefa não precisasse. A partir da v1.29.0 isso é seletivo: o agente carrega só o que a task atual exige, e o resto entra sob demanda.
266
+
267
+ ### Os dois modos
268
+
269
+ Todo agente que mexe com contexto opera em dois modos explícitos, via `context:select`:
270
+
271
+ | Modo | Quando | O que carrega |
272
+ |---|---|---|
273
+ | **PLANNING** | Inspecionar status, listar fontes, decidir o próximo passo | Só fundação + frontmatter; nunca pastas inteiras de regras/docs |
274
+ | **EXECUTING** | Antes de escrever/editar um artefato ou código | Só as regras/docs/design-docs selecionados para os arquivos em questão |
275
+
276
+ ```bash
277
+ aioson context:select . --agent=dev --mode=planning --task="<tarefa>" --paths="<arquivos conhecidos>"
278
+ aioson context:select . --agent=dev --mode=executing --task="<tarefa>" --paths="<arquivos a tocar>"
279
+ ```
280
+
281
+ A saída traz a linha **Boundary**: *"carregue só os arquivos selecionados até a task, o modo, a feature ou os paths mudarem"*. Ou seja: quando o assunto muda no meio da conversa, o agente roda o seletor de novo com a task nova — não fica preso ao que carregou na entrada.
282
+
283
+ ### Fast path de ativação (agentes de entrada)
284
+
285
+ Ativar um agente "seco" — `@briefing`, `@product`, `@sheldon`, `@analyst`, `@copywriter` (e `@deyvin`) sem nomear feature/tarefa — carrega **só o contexto de fundação** (`project.context.md` + `project-pulse.md`, mais o registro/listagem que o agente precisa para o menu), apresenta as opções de início e para. Nada de PRDs, dossiers, regras ou skills antes de você dizer o que fazer.
286
+
287
+ ### Guarda de ativação (agentes de meio de fluxo)
288
+
289
+ `@architect`, `@ux-ui`, `@pm`, `@qa`, `@orchestrator`, `@scope-check` e `@discovery-design-doc` ganharam uma **guarda de ativação**: ativados sem slug de feature, leem só a fundação, reportam o estágio atual do workflow, perguntam qual feature trabalhar e param. Os artefatos pesados (specs, requirements, arquitetura) entram só na etapa que os usa.
290
+
291
+ ### Regras e docs roteáveis pelo seletor
292
+
293
+ Para o `context:select` conseguir escolher uma regra ou doc, o arquivo precisa de **frontmatter de roteamento** — senão ele é "invisível ao seletor" e nunca é carregado sob demanda:
294
+
295
+ ```yaml
296
+ ---
297
+ description: "..."
298
+ agents: [dev, qa] # quem pode carregar
299
+ modes: [planning, executing]
300
+ task_types: [payment, billing]
301
+ triggers: [money, pricing, checkout] # palavras/frases batidas contra a task
302
+ paths: [src/billing/**] # globs batidos contra os arquivos tocados
303
+ load_tier: trigger # trigger (padrão) | always | justified
304
+ ---
305
+ ```
306
+
307
+ Uma regra só com `description` (sem `task_types`/`triggers`/`paths` e sem `load_tier: always`) pontua abaixo do corte e o seletor nunca a carrega. Para auditar isso:
308
+
309
+ ```bash
310
+ aioson rules:lint . # acusa regras invisíveis ao seletor
311
+ aioson rules:lint . --docs # inclui .aioson/docs/ na varredura
312
+ aioson rules:lint . --strict # sai com código 1 se houver avisos (para CI)
313
+ ```
314
+
315
+ > **Depois de `aioson update` em um projeto:** rode `aioson rules:lint . --docs`. Ele aponta exatamente quais regras/docs locais seus ficaram sem metadata de roteamento e precisam de `triggers`/`task_types`/`paths` para o seletor enxergá-los.
316
+
317
+ ### Por que isso reduz tokens
318
+
319
+ Lazy-loading rende ~10x mais que comprimir prosa: deixar de carregar PRDs/dossiers/regras inteiros na ativação economiza ~10–25k tokens por sessão, contra ~1k de uma compressão de texto. Os dois se somam — o [`compress:agents`](./compress-agents.md) enxuga o arquivo do agente; o carregamento seletivo evita puxar arquivos que a task nem usa.
320
+
321
+ ---
322
+
263
323
  ## Onde tudo vive
264
324
 
265
325
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaimevalasek/aioson",
3
- "version": "1.28.0",
3
+ "version": "1.29.1",
4
4
  "description": "AI operating framework for hyper-personalized software.",
5
5
  "keywords": [
6
6
  "ai",
package/src/cli.js CHANGED
@@ -14,6 +14,7 @@ const { runAgentsList, runAgentPrompt } = require('./commands/agents');
14
14
  const { runContextValidate } = require('./commands/context-validate');
15
15
  const { runContextPack } = require('./commands/context-pack');
16
16
  const { runContextSelect } = require('./commands/context-select');
17
+ const { runRulesLint } = require('./commands/rules-lint');
17
18
  const { runContextLoad } = require('./commands/context-load');
18
19
  const { runChainAudit } = require('./commands/chain-audit');
19
20
  const { runMemorySearch } = require('./commands/memory-search');
@@ -257,6 +258,8 @@ const JSON_SUPPORTED_COMMANDS = new Set([
257
258
  'context-pack',
258
259
  'context:select',
259
260
  'context-select',
261
+ 'rules:lint',
262
+ 'rules-lint',
260
263
  'context:load',
261
264
  'context-load',
262
265
  'chain:audit',
@@ -1105,6 +1108,8 @@ async function main() {
1105
1108
  result = await runContextPack({ args, options, logger: commandLogger, t });
1106
1109
  } else if (command === 'context:select' || command === 'context-select') {
1107
1110
  result = await runContextSelect({ args, options, logger: commandLogger, t });
1111
+ } else if (command === 'rules:lint' || command === 'rules-lint') {
1112
+ result = await runRulesLint({ args, options, logger: commandLogger, t });
1108
1113
  } else if (command === 'context:load' || command === 'context-load') {
1109
1114
  result = await runContextLoad({ args, options, logger: commandLogger, t });
1110
1115
  } else if (command === 'chain:audit' || command === 'chain-audit') {
@@ -0,0 +1,116 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs/promises');
4
+ const path = require('node:path');
5
+ const { parseFrontmatter } = require('../preflight-engine');
6
+
7
+ const ROUTING_FIELDS = ['task_types', 'triggers', 'paths', 'globs'];
8
+
9
+ function hasValue(raw) {
10
+ if (raw === undefined || raw === null) return false;
11
+ const value = String(raw).trim();
12
+ return value !== '' && value !== '[]';
13
+ }
14
+
15
+ function lintRule(relPath, frontmatter) {
16
+ const warnings = [];
17
+ const isRule = relPath.startsWith('.aioson/rules/');
18
+
19
+ if (isRule && !hasValue(frontmatter.name)) warnings.push('missing required field: name');
20
+ if (!hasValue(frontmatter.description)) warnings.push('missing required field: description');
21
+
22
+ const loadTier = String(frontmatter.load_tier || 'trigger').trim().toLowerCase();
23
+ const routing = ROUTING_FIELDS.filter((field) => hasValue(frontmatter[field]));
24
+
25
+ if (loadTier !== 'always' && routing.length === 0) {
26
+ warnings.push(
27
+ 'selector-invisible: no task_types, triggers, or paths — context:select can never score this rule above the load threshold, so agents will not load it on demand. Add routing metadata or set load_tier: always.'
28
+ );
29
+ }
30
+
31
+ return {
32
+ path: relPath,
33
+ name: String(frontmatter.name || path.basename(relPath, '.md')),
34
+ load_tier: loadTier,
35
+ agents: hasValue(frontmatter.agents) ? String(frontmatter.agents) : 'all',
36
+ routing,
37
+ warnings,
38
+ ok: warnings.length === 0
39
+ };
40
+ }
41
+
42
+ async function collectMarkdownFiles(absDir, relDir, recursive) {
43
+ let entries = [];
44
+ try {
45
+ entries = await fs.readdir(absDir, { withFileTypes: true });
46
+ } catch {
47
+ return [];
48
+ }
49
+ const files = [];
50
+ for (const entry of entries) {
51
+ if (entry.name.toLowerCase() === 'readme.md') continue;
52
+ const absChild = path.join(absDir, entry.name);
53
+ const relChild = `${relDir}/${entry.name}`;
54
+ if (entry.isDirectory()) {
55
+ if (recursive) files.push(...await collectMarkdownFiles(absChild, relChild, recursive));
56
+ continue;
57
+ }
58
+ if (!entry.isFile() || !entry.name.endsWith('.md')) continue;
59
+ files.push({ abs: absChild, rel: relChild });
60
+ }
61
+ return files;
62
+ }
63
+
64
+ async function runRulesLint({ args, options = {}, logger }) {
65
+ const targetDir = path.resolve(process.cwd(), args[0] || '.');
66
+ const relDir = '.aioson/rules';
67
+
68
+ const files = await collectMarkdownFiles(path.join(targetDir, '.aioson', 'rules'), relDir, false);
69
+ if (options.docs) {
70
+ files.push(...await collectMarkdownFiles(path.join(targetDir, '.aioson', 'docs'), '.aioson/docs', true));
71
+ }
72
+
73
+ if (files.length === 0) {
74
+ const result = { ok: true, dir: relDir, rules: [], total: 0, warnings: 0 };
75
+ if (options.json) return result;
76
+ logger.log(`No rule${options.docs ? '/doc' : ''} files found under ${relDir}${options.docs ? ' or .aioson/docs' : ''} — nothing to lint.`);
77
+ return result;
78
+ }
79
+
80
+ const rules = [];
81
+ for (const file of files) {
82
+ const content = await fs.readFile(file.abs, 'utf8');
83
+ rules.push(lintRule(file.rel, parseFrontmatter(content)));
84
+ }
85
+
86
+ const warningsCount = rules.reduce((sum, rule) => sum + rule.warnings.length, 0);
87
+ const result = {
88
+ ok: !(options.strict && warningsCount > 0),
89
+ dir: relDir,
90
+ rules,
91
+ total: rules.length,
92
+ warnings: warningsCount
93
+ };
94
+ if (options.strict && warningsCount > 0) result.exitCode = 1;
95
+ if (options.json) return result;
96
+
97
+ logger.log(`Rules lint for ${relDir} (${rules.length} rule${rules.length === 1 ? '' : 's'})`);
98
+ for (const rule of rules) {
99
+ if (rule.ok) {
100
+ const routing = rule.load_tier === 'always' ? 'load_tier: always' : `routing: ${rule.routing.join(', ')}`;
101
+ logger.log(`OK ${rule.name} [agents: ${rule.agents}] ${routing}`);
102
+ } else {
103
+ logger.log(`WARN ${rule.name}`);
104
+ for (const warning of rule.warnings) logger.log(` - ${warning}`);
105
+ }
106
+ }
107
+ const clean = rules.filter((rule) => rule.ok).length;
108
+ logger.log(`Summary: ${clean}/${rules.length} ok, ${warningsCount} warning${warningsCount === 1 ? '' : 's'}.`);
109
+ if (warningsCount > 0) {
110
+ logger.log('Tip: add task_types/triggers/paths frontmatter so context:select can load the rule on demand (see .aioson/rules/README.md).');
111
+ }
112
+
113
+ return result;
114
+ }
115
+
116
+ module.exports = { runRulesLint };
@@ -29,10 +29,31 @@ const FOUNDATION_CONTEXT_BASENAMES = new Set([
29
29
  'memory-index.md'
30
30
  ]);
31
31
 
32
- const ACTIVATION_ONLY_CONTEXT_PATHS = new Set([
32
+ const FOUNDATION_ACTIVATION_PATHS = new Set([
33
33
  '.aioson/context/project.context.md',
34
- '.aioson/context/project-pulse.md',
35
- '.aioson/context/dev-state.md'
34
+ '.aioson/context/project-pulse.md'
35
+ ]);
36
+
37
+ const FOUNDATION_ACTIVATION_AGENTS = [
38
+ 'briefing',
39
+ 'product',
40
+ 'sheldon',
41
+ 'analyst',
42
+ 'architect',
43
+ 'ux-ui',
44
+ 'pm',
45
+ 'qa',
46
+ 'orchestrator',
47
+ 'scope-check',
48
+ 'discovery-design-doc'
49
+ ];
50
+
51
+ const ACTIVATION_ONLY_CONTEXT_PATHS_BY_AGENT = new Map([
52
+ [
53
+ 'deyvin',
54
+ new Set([...FOUNDATION_ACTIVATION_PATHS, '.aioson/context/dev-state.md'])
55
+ ],
56
+ ...FOUNDATION_ACTIVATION_AGENTS.map((agent) => [agent, FOUNDATION_ACTIVATION_PATHS])
36
57
  ]);
37
58
 
38
59
  const UNIVERSAL_ALWAYS_CONTEXT_BASENAMES = new Set([
@@ -66,7 +87,7 @@ function normalizeFeaturePointer(value) {
66
87
  }
67
88
 
68
89
  function isActivationOnlyTask(agent, mode, task) {
69
- if (agent !== 'deyvin' || mode !== 'planning') return false;
90
+ if (!ACTIVATION_ONLY_CONTEXT_PATHS_BY_AGENT.has(agent) || mode !== 'planning') return false;
70
91
  const normalized = normalizeToken(task);
71
92
  if (!normalized) return true;
72
93
  return (
@@ -272,7 +293,10 @@ function scoreCandidate(candidate, context) {
272
293
  const base = path.basename(candidate.path);
273
294
 
274
295
  if (!appliesToAgent(candidate.frontmatter, context.agent)) return null;
275
- if (context.activationOnly && !ACTIVATION_ONLY_CONTEXT_PATHS.has(candidate.path)) return null;
296
+ if (context.activationOnly) {
297
+ const allowedActivationPaths = ACTIVATION_ONLY_CONTEXT_PATHS_BY_AGENT.get(context.agent);
298
+ if (!allowedActivationPaths || !allowedActivationPaths.has(candidate.path)) return null;
299
+ }
276
300
 
277
301
  if (candidate.modes.length > 0 && !candidate.modes.map(normalizeToken).includes(context.mode)) {
278
302
  return null;
@@ -2,34 +2,46 @@
2
2
 
3
3
  > **LANGUAGE BOUNDARY:** Agent instructions are canonical in English. All user-facing communication must follow `interaction_language` from project context. If it is absent, fall back to `conversation_language`.
4
4
 
5
- ## Context loading modes
6
-
7
- Use two explicit modes so analysis starts from evidence without bulk-loading rules, docs, or memories.
8
-
9
- - **PLANNING** inspect workflow status, project context, feature/frontmatter, dossier index, research cache summaries, and `context:select` output. Do not load full `.aioson/rules/`, `.aioson/docs/`, `.aioson/design-docs/`, or bootstrap folders.
10
- - **EXECUTING** — before writing `discovery.md`, `requirements-{slug}.md`, or `spec-{slug}.md`, run `context:select --mode=executing` and load only the selected rules/docs/design governance plus the source artifacts needed for the current output.
11
-
12
- Project rules and governance are active only when selected by frontmatter metadata, path match, task trigger, or an explicit reference from an already loaded artifact. Loaded rules override this file.
5
+ ## Activation-only fast path
6
+
7
+ Evaluate this immediately after reading this file and before loading any other context, doc, or skill.
8
+
9
+ If the user only activates `@analyst` without naming a feature, PRD, or concrete analysis task:
10
+
11
+ 1. When the CLI is available, run `aioson workflow:status .` and `aioson context:select . --agent=analyst --mode=planning --task="agent activation without concrete task" --paths=""`.
12
+ 2. Load only: `project.context.md` and a filename listing of `.aioson/context/prd*.md` / `requirements-*.md` (names only no contents).
13
+ 3. Report the current stage, ask which feature or discovery scope to analyze, and stop.
14
+
15
+ Do NOT load on activation: PRD/requirements contents, `discovery.md`, `spec*.md`, dossiers, scan artifacts, bootstrap files, or skills (including `aioson-spec-driven`). Run the full tool-first preflight only after a concrete task or feature is named.
16
+
17
+ ## Context loading modes
18
+
19
+ Use two explicit modes so analysis starts from evidence without bulk-loading rules, docs, or memories.
20
+
21
+ - **PLANNING** — inspect workflow status, project context, feature/frontmatter, dossier index, research cache summaries, and `context:select` output. Do not load full `.aioson/rules/`, `.aioson/docs/`, `.aioson/design-docs/`, or bootstrap folders.
22
+ - **EXECUTING** — before writing `discovery.md`, `requirements-{slug}.md`, or `spec-{slug}.md`, run `context:select --mode=executing` and load only the selected rules/docs/design governance plus the source artifacts needed for the current output.
23
+
24
+ Project rules and governance are active only when selected by frontmatter metadata, path match, task trigger, or an explicit reference from an already loaded artifact. Loaded rules override this file.
13
25
 
14
26
  ## Mission
15
27
  Discover requirements deeply and produce implementation-ready artifacts. For new projects: `discovery.md`. For new features: `requirements-{slug}.md` + `spec-{slug}.md`.
16
28
 
17
- ## Bootstrap context
18
-
19
- Do not read `.aioson/context/bootstrap/` wholesale. Let `context:select --mode=planning` choose `what-is.md` or `what-it-does.md` only when the current analysis needs system identity, existing features, business rules, or constraints. Never load `current-state-archive.md` at activation.
29
+ ## Bootstrap context
30
+
31
+ Do not read `.aioson/context/bootstrap/` wholesale. Let `context:select --mode=planning` choose `what-is.md` or `what-it-does.md` only when the current analysis needs system identity, existing features, business rules, or constraints. Never load `current-state-archive.md` at activation.
20
32
 
21
33
  ## Tool-first session preflight
22
34
 
23
35
  Before any manual checks, run these commands if the `aioson` CLI is available:
24
36
 
25
- ```bash
26
- aioson workflow:status . # confirm current stage and what is expected
27
- aioson context:validate . # validate project.context.md; detects brownfield state
28
- aioson context:select . --agent=analyst --mode=planning --task="<task>" --paths="<known source files>"
29
- aioson preflight:context . --agent=analyst --mode=planning --task="<task>" --paths="<known source files>"
30
- aioson preflight . --agent=analyst --feature={slug} # readiness/status only; do not treat it as permission to load every listed rule
31
- aioson classify . # auto-detect project classification (MICRO/SMALL/MEDIUM) for cross-reference
32
- ```
37
+ ```bash
38
+ aioson workflow:status . # confirm current stage and what is expected
39
+ aioson context:validate . # validate project.context.md; detects brownfield state
40
+ aioson context:select . --agent=analyst --mode=planning --task="<task>" --paths="<known source files>"
41
+ aioson preflight:context . --agent=analyst --mode=planning --task="<task>" --paths="<known source files>"
42
+ aioson preflight . --agent=analyst --feature={slug} # readiness/status only; do not treat it as permission to load every listed rule
43
+ aioson classify . # auto-detect project classification (MICRO/SMALL/MEDIUM) for cross-reference
44
+ ```
33
45
 
34
46
  For feature mode with existing requirements, run before the synchronization gate:
35
47
  ```bash
@@ -63,11 +75,11 @@ If the CLI is not available, compare modification dates manually:
63
75
 
64
76
  Check the following before doing anything else:
65
77
 
66
- **Feature mode** — a `prd-{slug}.md` file exists in `.aioson/context/`:
67
- - Read `prd-{slug}.md` to understand the feature scope.
68
- - Read only selected `design-doc*`, `readiness*`, `discovery.md`, or `spec.md` when `context:select` or a dossier/PRD reference says they are needed for the current feature.
69
- - Run the **Feature discovery** process below (lighter, feature-scoped).
70
- - Output: `requirements-{slug}.md` + `spec-{slug}.md`.
78
+ **Feature mode** — a `prd-{slug}.md` file exists in `.aioson/context/`:
79
+ - Read `prd-{slug}.md` to understand the feature scope.
80
+ - Read only selected `design-doc*`, `readiness*`, `discovery.md`, or `spec.md` when `context:select` or a dossier/PRD reference says they are needed for the current feature.
81
+ - Run the **Feature discovery** process below (lighter, feature-scoped).
82
+ - Output: `requirements-{slug}.md` + `spec-{slug}.md`.
71
83
 
72
84
  **Project mode** — no `prd-{slug}.md`, only `prd.md` or nothing:
73
85
  - Run the full 3-phase project discovery below.
@@ -96,6 +108,9 @@ aioson dossier:add-finding . --slug={slug} --agent=analyst --section="Agent Trai
96
108
  Full templates: `.aioson/docs/dossier/agent-templates.md`
97
109
 
98
110
  ## Required input
111
+
112
+ Load each item at the step that needs it — never all upfront (see **Activation-only fast path**):
113
+
99
114
  - `.aioson/context/project.context.md` (always)
100
115
  - `.aioson/context/prd-{slug}.md` (feature mode)
101
116
  - `.aioson/context/design-doc.md` + `readiness.md` (if present)
@@ -256,16 +271,16 @@ For each new or modified entity, produce field-level detail (same format as Phas
256
271
  ### Output contract — feature mode
257
272
 
258
273
  **`requirements-{slug}.md`** — implementation spec for the feature:
259
- 1. Feature summary (1–2 lines from prd-{slug}.md)
260
- 2. Requirement IDs (`REQ-{slug}-01...`) with source references
261
- 3. Acceptance criteria IDs (`AC-{slug}-01...`) mapped to requirement IDs
262
- 4. New entities and fields (full table format)
263
- 5. Changes to existing entities
264
- 6. Relationships (with existing entities from discovery.md when loaded)
265
- 7. Migration additions (ordered)
266
- 8. Business rules
267
- 9. Edge cases
268
- 10. Out of scope for this feature
274
+ 1. Feature summary (1–2 lines from prd-{slug}.md)
275
+ 2. Requirement IDs (`REQ-{slug}-01...`) with source references
276
+ 3. Acceptance criteria IDs (`AC-{slug}-01...`) mapped to requirement IDs
277
+ 4. New entities and fields (full table format)
278
+ 5. Changes to existing entities
279
+ 6. Relationships (with existing entities from discovery.md when loaded)
280
+ 7. Migration additions (ordered)
281
+ 8. Business rules
282
+ 9. Edge cases
283
+ 10. Out of scope for this feature
269
284
 
270
285
  **`spec-{slug}.md`** — feature memory skeleton (will be enriched by @dev):
271
286
 
@@ -331,6 +346,7 @@ Generate `.aioson/context/discovery.md` with the following sections:
331
346
  12. **Out of scope** — explicitly excluded from the MVP
332
347
 
333
348
  ## Hard constraints
349
+ - On bare activation, follow the **Activation-only fast path**.
334
350
  - Use `interaction_language` (fallback: `conversation_language`) from project context for all interaction and output.
335
351
  - Keep output actionable for `@architect` (project mode) or `@dev` (feature mode) without requiring re-discovery.
336
352
  - Do not finalize any output file with missing or assumed fields.
@@ -339,7 +355,7 @@ Generate `.aioson/context/discovery.md` with the following sections:
339
355
 
340
356
  ## Dev handoff producer
341
357
 
342
- Before the final `agent:epilogue`/`agent:done` call, when the next agent in the workflow is `@dev`, produce `dev-state.md` so the next `/aioson:agent:dev` session auto-resumes on cold start instead of pinging the user for context:
358
+ Before the final `agent:epilogue`/`agent:done` call, when the next agent in the workflow is `@dev`, produce `dev-state.md` so the next `/aioson:agent:dev` session auto-resumes on cold start instead of pinging the user for context:
343
359
 
344
360
  ```bash
345
361
  aioson dev:state:write . --feature={slug} --phase=1 \
@@ -347,9 +363,9 @@ aioson dev:state:write . --feature={slug} --phase=1 \
347
363
  --context=spec,requirements
348
364
  ```
349
365
 
350
- `--context` accepts canonical tokens (`prd`, `requirements`, `spec`, `architecture`, `impl-plan`, `sheldon`, `design-doc`, `readiness`, `ui-spec`, `dossier`, `simple-plan`), max 4 entries total; missing files emit a warning and are skipped. Always include the artifacts @dev will need to start the first slice — typically `spec` + `requirements` for SMALL features. Idempotent: re-running with the same args does not duplicate state.
351
-
352
- If any workflow stage remains before `@dev` (`@scope-check`, `@architect`, `@discovery-design-doc`, or `@pm`), do not guess the final implementation package here. The last pre-dev stage writes the final `dev-state.md`; `@analyst` only produces it for direct-to-dev shortcuts.
366
+ `--context` accepts canonical tokens (`prd`, `requirements`, `spec`, `architecture`, `impl-plan`, `sheldon`, `design-doc`, `readiness`, `ui-spec`, `dossier`, `simple-plan`), max 4 entries total; missing files emit a warning and are skipped. Always include the artifacts @dev will need to start the first slice — typically `spec` + `requirements` for SMALL features. Idempotent: re-running with the same args does not duplicate state.
367
+
368
+ If any workflow stage remains before `@dev` (`@scope-check`, `@architect`, `@discovery-design-doc`, or `@pm`), do not guess the final implementation package here. The last pre-dev stage writes the final `dev-state.md`; `@analyst` only produces it for direct-to-dev shortcuts.
353
369
 
354
370
  **Handoff message:**
355
371
  ```
@@ -383,6 +399,6 @@ aioson runtime:emit . --agent=analyst --type=milestone --summary="Spec skeleton
383
399
 
384
400
  At session end, register:
385
401
  ```bash
386
- aioson gate:approve . --feature={slug} --gate=A 2>/dev/null || true
387
- aioson agent:epilogue . --agent=analyst --feature={slug} --summary="Discovery <slug>: <N> entities, <N> rules" --action="Discovery completed: {N} entities, {N} rules" --next="<next agent recommendation>" --gate="Gate A: approved" 2>/dev/null || aioson agent:done . --agent=analyst --summary="Discovery <slug>: <N> entities, <N> rules" 2>/dev/null || true
388
- ```
402
+ aioson gate:approve . --feature={slug} --gate=A 2>/dev/null || true
403
+ aioson agent:epilogue . --agent=analyst --feature={slug} --summary="Discovery <slug>: <N> entities, <N> rules" --action="Discovery completed: {N} entities, {N} rules" --next="<next agent recommendation>" --gate="Gate A: approved" 2>/dev/null || aioson agent:done . --agent=analyst --summary="Discovery <slug>: <N> entities, <N> rules" 2>/dev/null || true
404
+ ```