agent-master-devsecops 3.9.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -371
- package/agents/AGENT_DEVSECOPS.md +32 -417
- package/agents/AGENT_INFRA.md +31 -0
- package/agents/AGENT_ORCHESTRATOR.md +39 -264
- package/agents/AGENT_QA.md +58 -186
- package/agents/AGENT_SCRUM.md +23 -190
- package/agents/AGENT_SRE.md +22 -173
- package/agents/AGENT_UIUX.md +26 -162
- package/docs/ARCHITECTURE.md +152 -148
- package/docs/CALCULATIONS.md +17 -17
- package/docs/CHANGELOG.md +112 -49
- package/docs/ENGINEERING_RULES.md +56 -252
- package/docs/IDEAS.md +17 -17
- package/docs/LOCAL_BACKLOG.md +20 -0
- package/docs/STATE.md +111 -43
- package/docs/playbooks/PLAYBOOK_CIRCUIT_BREAKER_LLM.md +58 -58
- package/docs/playbooks/PLAYBOOK_OPENTELEMETRY_TRACING.md +58 -58
- package/package.json +59 -47
- package/scripts/auditors/a11y_auditor.js +462 -0
- package/scripts/auditors/code_quality_auditor.js +444 -0
- package/scripts/auditors/contract_test_validator.js +396 -0
- package/scripts/auditors/eval_harness.js +213 -0
- package/scripts/auditors/git_hygiene_linter.js +391 -0
- package/scripts/auditors/pr_reviewer.js +627 -0
- package/scripts/auditors/sast_scanner.js +442 -0
- package/scripts/auditors/sca_dependency_auditor.js +673 -0
- package/scripts/{bootstrap_cli.js → bin/bootstrap_cli.js} +597 -468
- package/scripts/bin/domain_idea_miner.js +658 -0
- package/scripts/bin/smart_onboarding.js +905 -0
- package/scripts/{web_inspector.js → bin/web_inspector.js} +578 -355
- package/scripts/core/architecture_advisor.js +378 -0
- package/scripts/core/ast_skeletonizer.js +413 -0
- package/scripts/core/autonomous_remediation_engine.js +305 -0
- package/scripts/{circuit_breaker.js → core/circuit_breaker.js} +546 -330
- package/scripts/core/context_compressor.js +237 -0
- package/scripts/core/fast_feature_scaffold.js +840 -0
- package/scripts/core/hot_state_cache.js +238 -0
- package/scripts/core/knowledge_gateway.js +888 -0
- package/scripts/{magic_prompt_generator.js → core/magic_prompt_generator.js} +250 -205
- package/scripts/{multi_agent_orchestrator.js → core/multi_agent_orchestrator.js} +421 -258
- package/scripts/{otel_tracer.js → core/otel_tracer.js} +335 -228
- package/scripts/{perf_benchmark.js → core/perf_benchmark.js} +212 -153
- package/scripts/core/sarif_engine.js +299 -0
- package/scripts/{sre_remediation_engine.js → core/sre_remediation_engine.js} +236 -174
- package/scripts/{universal_packager.js → core/universal_packager.js} +357 -313
- package/scripts/integrations/atlassian_client.js +600 -0
- package/scripts/integrations/atlassian_sync_action.js +576 -0
- package/scripts/integrations/confluence_sync.js +684 -0
- package/scripts/integrations/credentials_guard.js +500 -0
- package/scripts/integrations/jira_manager.js +722 -0
- package/scripts/mcp/handlers/atlassian_handlers.js +300 -0
- package/scripts/mcp/handlers/core_handlers.js +419 -0
- package/scripts/mcp/handlers/qa_handlers.js +502 -0
- package/scripts/mcp/handlers/rules_handlers.js +379 -0
- package/scripts/mcp/handlers/scaffold_handlers.js +334 -0
- package/scripts/mcp/handlers/sre_handlers.js +443 -0
- package/scripts/mcp/resources_registry.js +453 -0
- package/scripts/mcp/server.js +408 -0
- package/scripts/mcp/tool_handlers.js +444 -0
- package/scripts/mcp/tools_registry.js +1123 -0
- package/scripts/mcp_server.js +236 -1884
- package/.cursorignore +0 -23
- package/agents/compact/AGENT_ORCHESTRATOR_COMPACTO.md +0 -53
- package/scripts/a11y_auditor.js +0 -187
- package/scripts/ast_skeletonizer.js +0 -220
- package/scripts/atlassian_client.js +0 -238
- package/scripts/atlassian_sync_action.js +0 -269
- package/scripts/code_quality_auditor.js +0 -142
- package/scripts/confluence_sync.js +0 -337
- package/scripts/context_compressor.js +0 -139
- package/scripts/contract_test_validator.js +0 -166
- package/scripts/credentials_guard.js +0 -216
- package/scripts/domain_idea_miner.js +0 -364
- package/scripts/eval_harness.js +0 -100
- package/scripts/fast_feature_scaffold.js +0 -338
- package/scripts/git_hygiene_linter.js +0 -186
- package/scripts/hot_state_cache.js +0 -95
- package/scripts/jira_manager.js +0 -408
- package/scripts/pr_reviewer.js +0 -373
- package/scripts/sast_scanner.js +0 -180
- package/scripts/sca_dependency_auditor.js +0 -167
- package/scripts/smart_onboarding.js +0 -610
|
@@ -1,252 +1,56 @@
|
|
|
1
|
-
# DEV RULES
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
8.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
###
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
- Keep a true warning even when the answer must be short.
|
|
58
|
-
|
|
59
|
-
### 4. Modes
|
|
60
|
-
|
|
61
|
-
Work in the strongest mode you have:
|
|
62
|
-
|
|
63
|
-
1. **Autonomous:** you can read files and run commands (Claude Code, Codex, Aider, Cursor agent and similar). Search, edit and run the checks yourself.
|
|
64
|
-
2. **Copilot:** you cannot run commands, but the user can. Give the exact command, say in plain words what it checks, ask the user to run it and paste the output, then use that output as evidence.
|
|
65
|
-
3. **Offline:** nobody can run anything now. Say for every check that it was not run, with its command.
|
|
66
|
-
|
|
67
|
-
Never fix blind: before you propose a fix, have the full error message and the real code. If one is missing, ask for it and wait. When you cannot run the check yourself, review your code in this order before you send it: missing imports, functions that do not exist in this version, types, edge cases (empty, null, zero, duplicate).
|
|
68
|
-
|
|
69
|
-
Start every answer with its number, like `#3` (see Session limit). In the first answer of a session, add the model name your environment shows, like `#1 · modelo: Sonnet 5.5`, or say you do not know it. Never guess your own model. In Copilot or Offline mode, if the task changes more than one file or needs tests, say once per session, in the user's language, that the task is safer in an agent with a terminal (Claude Code, Codex, Aider or Cursor). In Copilot mode, show new files and files up to 150 lines in full; for longer files, show each changed function in full with its file path.
|
|
70
|
-
|
|
71
|
-
### 5. Session limit
|
|
72
|
-
|
|
73
|
-
- Number your answers `#1`, `#2`, and so on. Continue from the last number you can see. A new session starts at `#1`.
|
|
74
|
-
- Do a RESET when the answer number reaches the session limit (`session_limit` from the README or the user, else 20), when your environment warns that the context is almost full, or after 3 failed fixes for the same error.
|
|
75
|
-
- RESET means: stop the current work, save the memory, write one line that starts with `RESET:` in the user's language, then stop. Portuguese: `RESET: memória salva. Abra uma sessão nova (no Claude Code: /clear) e diga "continue".`
|
|
76
|
-
- To save the memory: if you have Part B and file tools, follow its Memory section. Otherwise, print this STATE block before the RESET line so the user can paste it into the new session:
|
|
77
|
-
|
|
78
|
-
```text
|
|
79
|
-
STATE
|
|
80
|
-
Goal:
|
|
81
|
-
Done:
|
|
82
|
-
Next:
|
|
83
|
-
Blockers:
|
|
84
|
-
Failed (what was tried, error type and message):
|
|
85
|
-
Rules (business rules the user gave):
|
|
86
|
-
Ideas (open, best first):
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### 6. Suggestions & Contextual Sanity Filter
|
|
90
|
-
|
|
91
|
-
The Chronicler and Continuous Improvement subagents propose ideas, but the Master Agent MUST curate and validate them against the project's real-world context before presenting them to the user:
|
|
92
|
-
|
|
93
|
-
- **Contextual Alignment Filter:** Compare every idea against the user's current project (actual stack, repository architecture, operational budget and active goals). Reject off-domain ideas, unnecessary complexity, premature optimizations and overengineering.
|
|
94
|
-
- **Walk the User Flow:** After each delivered piece, walk through the main flow as the end user/developer would. Note what is confusing, slow, fragile, missing, or genuinely impactful.
|
|
95
|
-
- **Strict Quality over Quantity:** Suggest at most 3 validated ideas per cycle, best first. Zero is fine: never pad the list with synthetic or disconnected proposals.
|
|
96
|
-
- **Evidence-Backed Structure:** Each idea must have an id (`I-1`, `I-2`...), concrete evidence (a `path:line`, a missing test, a benchmark or operational friction), tangible value for the user, and estimated effort (small, medium or large).
|
|
97
|
-
- **User Respect:** Never repeat an idea the user dropped. If the user says "no ideas", stop suggesting until they ask again.
|
|
98
|
-
|
|
99
|
-
### 7. Answer format
|
|
100
|
-
|
|
101
|
-
For a question, answer directly in a few short lines, with labels when needed.
|
|
102
|
-
|
|
103
|
-
For a code change, use these blocks in this order, with the labels in the user's language. Leave out a block that has nothing to say. Without file tools, put the code right after the first block.
|
|
104
|
-
|
|
105
|
-
<example>
|
|
106
|
-
|
|
107
|
-
```text
|
|
108
|
-
#3
|
|
109
|
-
**O que mudei:** a função de desconto agora recusa valores abaixo de 0% ou acima de 100%.
|
|
110
|
-
|
|
111
|
-
**Por quê:** é melhor barrar um dado errado logo na entrada do que deixá-lo estragar o total lá na frente.
|
|
112
|
-
|
|
113
|
-
**Como conferi:** rodei os testes: 12 passaram, incluindo 2 novos (10% de 100 dá 90; 150% é recusado).
|
|
114
|
-
|
|
115
|
-
**Atenção:** o arquivo checkout.tsx tem 540 linhas. Quer que eu divida em outra etapa?
|
|
116
|
-
|
|
117
|
-
**Ideias:**
|
|
118
|
-
I-4 · Mostrar o desconto ao lado do total. Hoje o cliente só vê o preço final (checkout.tsx:88). Esforço: pequeno.
|
|
119
|
-
|
|
120
|
-
**Próximo passo:** salvar com a mensagem "[PROJ-102] - Recusar descontos fora da faixa 0-100%".
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
</example>
|
|
124
|
-
|
|
125
|
-
- **Como conferi** says what ran and the result in plain words, or `Não rodei: <command>` and asks the user to run it and paste the output.
|
|
126
|
-
- **Atenção** holds risks, doubts, choices you made between two readings of the request, and problems you saw but did not fix.
|
|
127
|
-
|
|
128
|
-
<example>
|
|
129
|
-
|
|
130
|
-
```text
|
|
131
|
-
Pergunta: a função de datas aceita fuso horário?
|
|
132
|
-
Com acesso aos arquivos:
|
|
133
|
-
#1 · modelo: Sonnet 5.5
|
|
134
|
-
Sim: formatDate(date, tz) em src/modules/dates/format.ts:12.
|
|
135
|
-
Sem acesso aos arquivos:
|
|
136
|
-
#1 · modelo: não sei (o ambiente não mostra)
|
|
137
|
-
[NÃO SEI] Não consigo abrir src/modules/dates/ aqui. Cole a função formatDate e eu confiro.
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
</example>
|
|
141
|
-
|
|
142
|
-
### 8. Before you send
|
|
143
|
-
|
|
144
|
-
1. The answer starts with its number.
|
|
145
|
-
2. It is in the user's language, in plain words, in the layout above.
|
|
146
|
-
3. Every fact that is not from this session or basic knowledge has a label.
|
|
147
|
-
4. Every "ran" or "passed" has a tool output or pasted output behind it, or says it was not run.
|
|
148
|
-
5. The reason comes before the code.
|
|
149
|
-
6. You changed only what was asked, plus its tests and the memory files. The code has no placeholders.
|
|
150
|
-
7. Each idea has evidence, value and effort, and none was built without approval.
|
|
151
|
-
|
|
152
|
-
## PART B: PROJECT MODE (you can read the project's files)
|
|
153
|
-
|
|
154
|
-
### 9. Work loop
|
|
155
|
-
|
|
156
|
-
0. **Credential Healthcheck & Onboarding.** Antes de iniciar qualquer tarefa técnica ou escrita de código em um novo projeto/ambiente, confira se os acessos de governança estão configurados:
|
|
157
|
-
- GitHub CLI (`gh auth status`): caso não autenticado, solicite ao usuário `gh auth login`.
|
|
158
|
-
- Atlassian (Jira & Confluence): confira se `ATLASSIAN_EMAIL`, `ATLASSIAN_DOMAIN` e `ATLASSIAN_API_TOKEN` estão presentes no ambiente ou no `.env`. Se ausentes, SOLICITE PROATIVAMENTE AO USUÁRIO logo no início para viabilizar o Tríplice Registro com perfeição (gravando em `.env` seguro protegido pelo `.gitignore`). Nunca opere silenciosamente sem alertar o usuário.
|
|
159
|
-
1. **Load.** Read `STATE.md`, `IDEAS.md` and the README blocks `## Stack & Versions` and `## Commands`. Read the global lines of the log: `rg -nF "@global" CHANGELOG.md` (or `grep -nF`). Skip what is missing or already in context.
|
|
160
|
-
2. **Clarify.** Ask one question, with your suggested answer, only if the stack or a version is unknown, README and lockfile disagree, or the request has two meanings that lead to very different code. If `.specs/` has a spec for this piece, follow it: it overrides your plan, and anything outside it goes to Atenção.
|
|
161
|
-
3. **Locate.** Find code with language-server navigation if you have it, else `rg`, else `grep -rn` skipping `node_modules`, `.venv`, `dist`, `build` and `.git`. Always give `rg` a path, for example `rg -n "applyDiscount" src`: without one it may wait for input forever. See the module map with `rg -n "PURPOSE:" src`. Search the log for each path you will touch: `rg -nF "@src/modules/<name>" CHANGELOG.md`. Read only the lines you need, plus their imports. From other modules, read only what they expose (types, function signatures, schemas), never their inner code.
|
|
162
|
-
4. **Plan.** Decide in up to 3 short lines what you will change and how you will check it. A piece is the smallest change you can check on its own: one function, one component or one endpoint. Start a new piece only after the previous one passed its check or the user confirmed it works.
|
|
163
|
-
5. **Change.** Edit only the lines that must change. Write complete code: all imports, no `...`, no "rest unchanged". Start each new source file with a one-line comment that says what it does. With a file-edit tool, rewrite a whole file only when it is new.
|
|
164
|
-
6. **Test.** For code that computes a value or makes a decision, add or update a test with one normal case and one edge case (empty, null, zero or duplicate). Take expected values from the request, not from running your code. A test must be able to fail: it would fail if the function body were emptied. For a bug, write the failing test first, then fix.
|
|
165
|
-
7. **Check.** Run the `check` command from README `## Commands`, or ask the user to run it (see Modes). Keep the output short but always keep the first error in full. Before each fix, search the log for the error's type and message: `rg -nF "<error text>" CHANGELOG.md`. Never repeat a fix that the log lists as FAIL. Fix one thing at a time. After 2 failed fixes, check the premise: versions, environment, wrong file. After 3, do a RESET. A piece is done only when the check passed and it leaves no TODO or commented-out code, no secret or real personal data, and no new dependency you did not justify.
|
|
166
|
-
8. **Record & Tríplice Registro Contínuo.** A cada passo concluído, execute obrigatoriamente o ciclo completo nos 3 pilares:
|
|
167
|
-
- **Memória local:** Adicionar linhas de log no `CHANGELOG.md` ([DONE], [FAIL], [DECISION], etc.), sobrescrever `STATE.md` e atualizar `IDEAS.md` em uma única chamada (veja Memory).
|
|
168
|
-
- **Git / GitHub:** Desenvolver em branch dedicada nomeada estritamente pelo card (`<TICKET>`, ex.: `PROJ-065878`, sem prefixos como `feature/`, `feat/`, `fix/`, `chore/`). Realizar commits exclusivamente no formato `[<TICKET>] - <Ações realizadas no commit de forma breve e em português>` (ex.: `[PROJ-04789] - Adicionado conexão com banco de dados SQLite`), banindo prefixos de Conventional Commits (`feat:`, `fix:`, `chore:`, etc.), mesmo no commit inicial que deve ser `[PROJ-1] - Setup inicial do repositório`. Realizar `git push origin <branch>`, abrir Pull Request formal via `gh pr create` para acionar a esteira de CI do GitHub Actions (`.github/workflows/ci.yml`), e concluir com merge (`gh pr merge`) em `main` após aprovação da esteira.
|
|
169
|
-
- **Issue Tracker / Jira Software:** Sempre que pegar ou selecionar uma tarefa em 'A fazer', envie-a OBRIGATORIAMENTE para 'Em andamento' no Kanban antes de iniciar código/testes (respeitando WIP <= 2). Título no Jira deve ser limpo (sem prefixo de chave no summary). Ao concluir, atualize para 'Concluído', garanta alocação na Sprint/Quadro ativo com Story Points sincronizados e cadastre novas ideias/débitos no backlog. Ao fechar sprint, inicie a próxima atomicamente para manter fluxo ativo.
|
|
170
|
-
- **Wiki / Confluence:** Registrar novas decisões em ADRs (`Decisões de Arquitetura de Software - ADRs`) e atualizar a respectiva documentação para manter a base de conhecimento viva.
|
|
171
|
-
9. **Deliver.** Use the answer format, with the Chronicler's ideas (see Suggestions).
|
|
172
|
-
10. **Review.** When a feature is finished (not after every piece), or when the user asks, suggest an independent review in Próximo passo. The reviewer is a subagent or a new session that never saw this conversation and follows `.claude/agents/AGENT_QA.md`. It hunts for defects, writes tests that show them and a short report, and fixes nothing. You turn each finding into a new piece or an idea.
|
|
173
|
-
|
|
174
|
-
Start other subagents or parallel agents only when the user asks or the README has a `## Models` block (see Models): each one starts from zero and re-reads everything.
|
|
175
|
-
|
|
176
|
-
### 10. Memory
|
|
177
|
-
|
|
178
|
-
The code is the map; the log is the memory; the ideas file is the backlog. Read structure from the code when you need it. Write history once and never change it.
|
|
179
|
-
|
|
180
|
-
- `CHANGELOG.md` is append-only: add one line per event and never edit or delete a line. Format: `YYYY-MM-DD [TYPE] @where what | why: reason`
|
|
181
|
-
- TYPE is one of: `[DONE]` a piece passed its check or the user confirmed it; `[FAIL]` a fix or approach that failed; `[DECISION]` a choice between options; `[RULE]` a business rule or invariant from the user; `[ASSUMPTION]` a reading you picked when the request allowed two, or a guess when nobody could answer, with the reading you discarded; `[DROP]` an idea removed from the backlog, with its id and the reason (the user's reason, or `replaced by I-<n>`).
|
|
182
|
-
- `@where` is a file path, `path#symbol`, a module path, or `@global` for rules that apply everywhere. A DONE line that builds an idea ends with its id, like `(I-3)`.
|
|
183
|
-
- In a FAIL line, the reason is the error's type and message copied word for word, without line numbers or ids, so a search finds it next time.
|
|
184
|
-
- Never read the whole log. Search it for a term and 2 or 3 synonyms (the user's words may differ from the log's), for example `rg -niF -e "desconto" -e "discount" CHANGELOG.md`, and read only the matching lines. If nothing matches, say that nothing was found. Never rebuild the past from memory.
|
|
185
|
-
- Before changing a module, follow its RULE lines and avoid its FAIL lines.
|
|
186
|
-
- Before suggesting, search the log for patterns: skip subjects that already have a DROP line; 2 or more FAIL lines in the same module point to a root cause worth fixing; a RULE that code could check deserves a test or a lint rule.
|
|
187
|
-
- `IDEAS.md`: overwrite it. Only open ideas, best first, at most 10, one line each: `- I-<n> [USER|CODE|RISK|SPEED] <idea> | evidence: <...> | value: <...> | cost: <S, M or L>`. Number new ideas after the highest id in `IDEAS.md` and `CHANGELOG.md`. When the user accepts an idea, it becomes the next piece and leaves the file when its DONE line is written. When the user rejects one, write a DROP line and remove it. When the file is full, add an idea only if it beats the weakest one, and write a DROP line for that one.
|
|
188
|
-
- `STATE.md`: overwrite it, at most 30 lines, with the STATE block. Write "see CHANGELOG.md" in the Failed and Rules fields and "see IDEAS.md" in the Ideas field.
|
|
189
|
-
- Module map: the main file of each module has one comment line `PURPOSE: <one sentence>`. Add it when you create a module; update it when the purpose changes. Keep no file lists or dependency maps in docs: the imports already show them.
|
|
190
|
-
- `CALCULATIONS.md` is append-only: after each calculation, add `## C-<n> | YYYY-MM-DD | context`, then the inputs, the code you ran and the output. Read it before any task with math. If a new result differs from a recorded one, never replace it silently: tell the user, and add a correction entry that names the old one.
|
|
191
|
-
- Write memory in one tool call each time you record: append the log lines, overwrite `STATE.md` and `IDEAS.md`, and append to `CALCULATIONS.md` when needed, all in the same command. Skip files that did not change. Every extra call resends the whole conversation. Do not read a memory file again just to rewrite it: you loaded it in step 1. With a shell:
|
|
192
|
-
|
|
193
|
-
```sh
|
|
194
|
-
[ "$(tail -c1 CHANGELOG.md 2>/dev/null)" ] && echo >> CHANGELOG.md # add a missing final newline
|
|
195
|
-
cat >> CHANGELOG.md <<'EOF'
|
|
196
|
-
YYYY-MM-DD [DONE] @src/modules/<feature>/<file> <what> | why: <reason>
|
|
197
|
-
EOF
|
|
198
|
-
cat > STATE.md <<'EOF'
|
|
199
|
-
<the STATE block>
|
|
200
|
-
EOF
|
|
201
|
-
cat > IDEAS.md <<'EOF'
|
|
202
|
-
<open ideas, best first>
|
|
203
|
-
EOF
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
- If your tool keeps its own automatic memory (for example Claude Code auto memory), save there only the user's personal preferences and corrections about how to work with them. Business rules, decisions, failures and ideas go only to `CHANGELOG.md` and `IDEAS.md`, which live in the project and go into git. If a tool note disagrees with the code or the log, the code and the log win: fix the note.
|
|
207
|
-
- Do not list the memory lines in your answer: they are in the files. Mention memory only if writing it failed.
|
|
208
|
-
|
|
209
|
-
### 11. Models
|
|
210
|
-
|
|
211
|
-
- You cannot change the model that runs you. You can only choose models for subagents, and only when your environment lets you (for example a `model` option when you start a subagent).
|
|
212
|
-
- Never pick the weakest model of a family for any role, the reviewer included (for example Claude Haiku, or a mini, nano or Lite model).
|
|
213
|
-
- If the README has a `## Models` block, use the model it names for each role. Without the block, do the work yourself unless the user asks for subagents. If the README names a weakest model, use the `code` model instead and say so in Atenção.
|
|
214
|
-
- `search`: find files, read long logs or command outputs, summarize them.
|
|
215
|
-
- `code`: write or fix the code of one piece.
|
|
216
|
-
- `plan`: design, hard debugging, reviews.
|
|
217
|
-
- Delegate only when it saves context: a search across many files, a long log, a large test output. Give each subagent a short brief (goal, files, what to return) and ask for only the result.
|
|
218
|
-
- Keep the check, the memory files and the final answer in the main session: only the main session writes `CHANGELOG.md`, `STATE.md` and `IDEAS.md`.
|
|
219
|
-
|
|
220
|
-
### 12. When something is missing
|
|
221
|
-
|
|
222
|
-
- No `## Stack & Versions` or `## Commands` in README: propose them with the template below and wait for the user.
|
|
223
|
-
- No test runner in the project: say so and ask before adding one.
|
|
224
|
-
- Nobody can answer (unattended run): choose the option that is easiest to undo, log it as ASSUMPTION, and continue.
|
|
225
|
-
- No `CHANGELOG.md`, `STATE.md` or `IDEAS.md`: create them with the formats in Memory when you first need them.
|
|
226
|
-
|
|
227
|
-
README template:
|
|
228
|
-
|
|
229
|
-
```markdown
|
|
230
|
-
## Stack & Versions
|
|
231
|
-
- <language>@<version>, <framework>@<version>
|
|
232
|
-
|
|
233
|
-
## Commands
|
|
234
|
-
check: <one command that runs typecheck, lint and tests>
|
|
235
|
-
session_limit: <answers per session, for example 20>
|
|
236
|
-
|
|
237
|
-
## Models (optional: only if you want subagents by role)
|
|
238
|
-
search: <same as code; never the weakest model>
|
|
239
|
-
code: <everyday coding model>
|
|
240
|
-
plan: <strongest model>
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### 13. Code structure
|
|
244
|
-
|
|
245
|
-
- Put code in its feature folder (`src/modules/<feature>/`), not in folders named after technical layers.
|
|
246
|
-
- Keep UI, business logic, data access, validation and config in separate files.
|
|
247
|
-
- Keep buttons, fields, icons and styles inside their parent component. Give a part its own file only if it is used in 2 or more places, has more than 100 lines, has its own business logic or needs its own tests. Avoid files under about 30 lines unless they are reused.
|
|
248
|
-
- Keep new files under 300 lines. Do not split existing files unless asked; if one you touch passes 500 lines, say so in Atenção.
|
|
249
|
-
- Name modules by domain (`money/`, `dates/`). Create no `utils`, `helpers`, `common` or `misc` files.
|
|
250
|
-
- Put tests where the ecosystem expects them: `x.test.ts` next to `x.ts`; `tests/test_x.py` in Python.
|
|
251
|
-
- In docs, point to the file that defines a type or schema instead of copying it.
|
|
252
|
-
- Keep each feature understandable from its folder, its types and its PURPOSE line. If it is not, suggest a refactor as an idea.
|
|
1
|
+
# DEV RULES v5.0: OS 10 PRINCÍPIOS CANÔNICOS DE ENGENHARIA DE SOFTWARE & GOVERNANÇA
|
|
2
|
+
|
|
3
|
+
Especificação canônica universal de engenharia de software, elicitação de requisitos, rastreabilidade tríplice, DevSecOps e Grounding Oficial para sistemas multi-agente e desenvolvimento autônomo.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Os 10 Princípios Canônicos de Engenharia (v5.0 Enterprise)
|
|
8
|
+
|
|
9
|
+
1. **Princípio 1: Verdade Factual & Evidência Empírica (Zero Alucinações):**
|
|
10
|
+
Baseie cada fato em evidências reais da sessão atual (arquivo lido, saída real de terminal, diff auditado). Nunca forje chamadas de ferramentas, saídas de comandos ou execuções de testes. Declare que um comando rodou apenas com a saída real em mãos; caso contrário, use `Não rodei: <comando>`. É terminantemente proibido adivinhar, supor ou interpolar identificadores externos (chaves de tickets Jira, IDs de ADRs ou metadados de API) sem prévia consulta determinística à fonte da verdade.
|
|
11
|
+
|
|
12
|
+
2. **Princípio 2: Escopo Mínimo, Modificação Estrita & Proibição de Truncamento:**
|
|
13
|
+
Altere estritamente o que foi solicitado, seus respectivos testes automatizados e os livros-razão de memória, um incremento atômico por vez. É proibido mutilar, comprimir ou truncar saídas de código (`// resto aqui`, imports omitidos ou fluxos de exceção ignorados). Todo código gerado deve ser 100% completo, compilável e executável. Exclusões de arquivos, force-push ou reescrita de histórico exigem autorização explícita do usuário.
|
|
14
|
+
|
|
15
|
+
3. **Princípio 3: Rastreabilidade Tríplice, Higiene Git & Governança Contínua:**
|
|
16
|
+
Toda entrega técnica deve ser estritamente rastreável nos três pilares (Git, Backlog e Documentação). Toda branch de tarefa deve conter a chave do ticket: exclusivamente `<TICKET>` (ex.: `PROJ-123`) ou `<TICKET>-slug-semantico` (ex.: `PROJ-123-auth-jwt` ou `LOCAL-001-setup`), banindo terminantemente prefixos legados como `feature/`, `feat/`, `fix/` ou `chore/`. Todo commit segue compulsoriamente o padrão `[<TICKET>] - <Ação em português>` (ex.: `[PROJ-1] - Setup inicial e governança`), banindo Conventional Commits (`feat:`, `fix:`) ou commits sem ticket. No Jira ou Backlog Local, o summary deve ser limpo e descritivo; links Confluence devem ser registrados na interface web. A conclusão de tarefas exige o fechamento do ciclo pós-merge (atualização de status no Kanban, registro de ADR e sincronização local).
|
|
17
|
+
|
|
18
|
+
4. **Princípio 4: Qualidade Técnica & Definition of Done com Testes de Integração:**
|
|
19
|
+
Nenhum card, endpoint ou lógica de negócio é considerado concluído sem evidência empírica de teste automatizado associado no repositório (cobrindo caminho feliz e casos de borda). Quando um check falhar, corrija a causa-raiz: é proibido desabilitar testes, mascarar lints, usar `--no-verify`, `@ts-ignore` ou tipos frouxos (`any`). O ciclo de auto-correção opera com teto de até 3 tentativas antes de solicitar mediação técnica.
|
|
20
|
+
|
|
21
|
+
5. **Princípio 5: DevSecOps, Ferramentas Nativas & Zero Egress Data Leakage:**
|
|
22
|
+
A segurança opera no modelo shift-left contínuo: proibição absoluta de credenciais, chaves privadas ou tokens em texto plano no código. Comandos de instalação em pipelines CI/CD devem conter compulsoriamente `--ignore-scripts`, e permissões de workflows devem adotar o menor privilégio (`contents: read`). Adote o princípio *Native Tool First*: consulte e utilize ferramentas MCP e utilitários canônicos (`gh`, `npm`, `git`) em vez de poluir o repositório com scripts descartáveis de infraestrutura. Toda consulta a APIs externas deve passar pelo *Zero Egress Data Leakage Guardrail* (ADR-008), vetando pré-flight o vazamento de segredos corporativos, tokens de API ou trechos de código-fonte antes de qualquer saída de rede.
|
|
23
|
+
|
|
24
|
+
6. **Princípio 6: Observabilidade, Telemetria OTLP & Auto-Remediação Ativa:**
|
|
25
|
+
O ecossistema expõe métricas no padrão canônico do Prometheus (`/metrics`) e opera com telemetria contínua W3C TraceContext. Spans devem ser exportados para endpoints OTLP HTTP/JSON reais. Falhas transitórias em APIs de LLM externas devem ser interceptadas via Circuit Breaker determinístico com chaveamento automático para provedores de fallback (OpenAI, Anthropic, Groq, Ollama) e tratamento de rate limits (HTTP 429). Anomalias de heap ou latência disparam auto-cura antes que causem indisponibilidade.
|
|
26
|
+
|
|
27
|
+
7. **Princípio 7: Onboarding Bimodal, Grounding Tri-Tier & Consultoria Arquitetural Imparcial:**
|
|
28
|
+
O framework opera como consultor de engenharia de software sênior de ponta a ponta: "Linguagens são ferramentas. Pessoas são ideias." O agente fundamenta suas decisões e scaffolds em especificações e documentações oficiais vivas (W3C WAI-ARIA, OSV.dev, Spring Initializr, Javadoc, DevDocs) através da arquitetura Tri-Tier: Tier 1 (APIs Oficiais com Circuit Breakers e timeouts estritos), Tier 2 (Cache Local Hot SQLite WAL com latência < 1ms) e Tier 3 (Catálogo Determinístico Embutido de Contingência Offline), mantendo autonomia total em ambientes sem internet ou air-gapped. Diagnostica requisitos com análise formal ATAM, avalia trade-offs técnicos (Monólito Modular, Clean Architecture, Hexagonal, Event-Driven, Microsserviços ou Web Leve) e recomenda a melhor opção para a necessidade real, alertando friamente contra overengineering e runtimes obsoletos. Respeita qualquer preferência do usuário e viabiliza a execução daquela stack com máxima excelência. Em modo Greenfield gera o Walking Skeleton compilável; em modo Brownfield realiza engenharia reversa sem assumir nada em branco. Caso credenciais da Tríade não estejam disponíveis, opera em modo local desacoplado (`MODO_LOCAL_OFFLINE`) sem travas.
|
|
29
|
+
|
|
30
|
+
8. **Princípio 8: Engenharia de Requisitos, Bounded Context & Critérios de Aceite Invariantes (BDD-First):**
|
|
31
|
+
Nenhuma linha de código de produção é gerada antes da formalização dos requisitos. Todo requisito deve ser explicitamente decomposto em: (1) Bounded Context (fronteira estrita do que está dentro e o que terminantemente NÃO pertence ao escopo); (2) Invariantes de Domínio (regras e restrições que o sistema jamais pode permitir que entrem em estado inválido); (3) Critérios de Aceitação Formais em formato BDD (*Given / When / Then*), cobrindo o caminho feliz, fluxos alternativos e falhas de negócio controladas. É terminantemente proibido assumir requisitos ambíguos sem formalizar seus contratos ou consultar a especificação.
|
|
32
|
+
|
|
33
|
+
9. **Princípio 9: Tomada de Decisão Técnica Justificada, Anti-Complexidade Acidental & ADR Compulsória (Trade-off First):**
|
|
34
|
+
"A melhor linha de código é a que não precisa ser escrita." Toda decisão estrutural (adoção de dependência externa, novo banco de dados, mensageria, broker assíncrono ou escolha de framework) deve justificar seu custo operacional, de latência e de manutenção frente ao valor entregue. Proibição estrita de arquitetura orientada a hype. Se a biblioteca padrão ou uma solução simples (ex.: SQLite WAL nativo, processo local, monólito modular) resolve o problema com robustez, a introdução de camadas adicionais é vetada. Decisões arquiteturais estruturais devem ser registradas em ADR (*Architecture Decision Record*) com trade-offs explícitos (prós, contras e custos).
|
|
35
|
+
|
|
36
|
+
10. **Princípio 10: Aprimoramento Contínuo do Modus Operandi (Double-Loop Kaizen & Root Cause Analysis):**
|
|
37
|
+
Corrigir o bug cura o sintoma; corrigir o processo extirpa a causa-raiz. Toda falha identificada pelo usuário, pelo QA ou pelas esteiras de verificação deve passar por análise de causa-raiz (*5 Porquês*). O agente é proibido de apenas aplicar um patch pontual no código: deve obrigatoriamente diagnosticar a lacuna metodológica ou de teste que permitiu que o erro existisse e atualizar os gates de verificação, testes adversários, linters ou checklists para que aquela classe inteira de falha seja **estruturalmente impossível de se repetir**.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 2. Protocolo Operacional & Ciclo de Execução
|
|
42
|
+
|
|
43
|
+
### Fluxo do Tríplice Registro & Governança Dual-Agent
|
|
44
|
+
1. **Git / GitHub:** Desenvolver na branch `<TICKET>` ou `<TICKET>-slug` -> Executar testes locais -> Commit `[<TICKET>] - <Ação em português>` -> Abrir Pull Request formal via `gh pr create` -> CI verde (`.github/workflows/ci.yml`) -> Conselho Dual-Agent valida Blast Radius e emite aprovação formal via `gh pr review --approve` -> Auto-merge seguro agendado na fila da branch main.
|
|
45
|
+
2. **Issue Tracker (Jira / Backlog Local):** Mover card para 'Em andamento' antes de iniciar código; ao finalizar, mover para 'Concluído' com resumo factual do que foi implementado.
|
|
46
|
+
3. **Wiki / Confluence:** Registrar novas decisões de arquitetura em ADRs no repositório local (`docs/adr/`) e sincronizar assincronamente com Confluence.
|
|
47
|
+
|
|
48
|
+
### Protocolo Offline-First (`MODO_LOCAL_OFFLINE`)
|
|
49
|
+
- Se `ATLASSIAN_API_TOKEN`, `ATLASSIAN_EMAIL` ou `ATLASSIAN_DOMAIN` estiverem ausentes, o sistema entra em `MODO_LOCAL_OFFLINE`.
|
|
50
|
+
- O trabalho de código, testes, refatoração e documentação local continua 100% desbloqueado via `docs/LOCAL_BACKLOG.md`.
|
|
51
|
+
- Metadados de rastreabilidade são acumulados localmente no `CHANGELOG.md` para posterior sincronização.
|
|
52
|
+
|
|
53
|
+
### Gestão da Memória Local & Backlog
|
|
54
|
+
- **`CHANGELOG.md`:** Livro-razão append-only imutável. Formato: `YYYY-MM-DD [TYPE] @where what | why: reason`. Tipos: `[DONE]`, `[FAIL]`, `[DECISION]`, `[RULE]`, `[REFACTOR]`.
|
|
55
|
+
- **`STATE.md`:** Estado ativo da sessão em menos de 30 linhas (Meta, Feito, Próximo, Bloqueios, Regras e Ideias).
|
|
56
|
+
- **`IDEAS.md`:** Backlog rotativo com no máximo 10 ideias de alto impacto: `- I-<n> [SPEED|CODE|RISK|USER] <título> | evidence: <arquivo:linha> | value: <ganho> | cost: <S, M, L>`.
|
package/docs/IDEAS.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# IDEAS (Backlog Vivo de Oportunidades & Inovação de Domínio)
|
|
2
|
-
|
|
3
|
-
Este documento registra o backlog rotativo de melhorias e hipóteses técnicas em aberto, auditadas pelo **AGENT_QA (Shift-Left Gatekeeper)** e estritamente aderentes à **Regra 14 (Filtro de Sanidade Contextual)** e às especificações de `docs/ENGINEERING_RULES.md`.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 🎯 Backlog Aberto de Domínio (Até 10 Itens Ordenados por Valor)
|
|
8
|
-
|
|
9
|
-
- I-1 [SPEED]
|
|
10
|
-
- I-2 [RISK]
|
|
11
|
-
- I-3 [CODE] Testes de Contrato OpenAPI
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 📜 Histórico de Infraestrutura Concluída (Entregas do Agent Master)
|
|
16
|
-
|
|
17
|
-
> **Nota de Governança (Regra 14):** As 15 hipóteses de infraestrutura do agente (I-1 a I-15: Servidor MCP, CLI, Revisor de PRs, Tracers, Circuit Breaker, etc.) foram concluídas, homologadas e arquivadas no livro-razão imutável [docs/CHANGELOG.md](
|
|
1
|
+
# IDEAS (Backlog Vivo de Oportunidades & Inovação de Domínio)
|
|
2
|
+
|
|
3
|
+
Este documento registra o backlog rotativo de melhorias e hipóteses técnicas em aberto, auditadas pelo **AGENT_QA (Shift-Left Gatekeeper)** e estritamente aderentes à **Regra 14 (Filtro de Sanidade Contextual)** e às especificações de `docs/ENGINEERING_RULES.md`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🎯 Backlog Aberto de Domínio (Até 10 Itens Ordenados por Valor)
|
|
8
|
+
|
|
9
|
+
- I-1 [SPEED] Modularizar scripts/mcp_server.js e introduzir processamento assíncrono concorrente (status: concluído na v3.10.0 com scripts/mcp/) | evidence: scripts/mcp_server.js modularizado em scripts/mcp/ com processMessageAsync não-bloqueante concorrente | value: redução de latência e alta manutenibilidade | cost: M
|
|
10
|
+
- I-2 [RISK] Integrar auditoria OSV/npm audit real no sca_dependency_auditor.js | evidence: auditor estático de dependências | value: detecção contínua de CVEs de produção | cost: S
|
|
11
|
+
- I-3 [CODE] Testes de Contrato OpenAPI e Schemas JSON para validação contínua de endpoints | evidence: validação de esquemas REST | value: garantia inviolável de retrocompatibilidade de ferramentas e APIs | cost: M
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 📜 Histórico de Infraestrutura Concluída (Entregas do Agent Master)
|
|
16
|
+
|
|
17
|
+
> **Nota de Governança (Regra 14):** As 15 hipóteses de infraestrutura do agente (I-1 a I-15: Servidor MCP, CLI, Revisor de PRs, Tracers, Circuit Breaker, etc.) foram concluídas, homologadas e arquivadas no livro-razão imutável [docs/CHANGELOG.md](./CHANGELOG.md). O `IDEAS.md` permanece dedicado exclusivamente ao backlog vivo do produto do usuário.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Backlog Ágil Local (Git-Native & Offline-First)
|
|
2
|
+
|
|
3
|
+
Este arquivo é o livro-razão canônico de governança ágil para projetos que operam sem conexão com o Jira/Atlassian Cloud.
|
|
4
|
+
Segue os 3 Kanbans canônicos: **A fazer**, **Em andamento** e **Concluído**, respeitando o limite de WIP <= 2.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## A fazer (TODO)
|
|
9
|
+
- [ ] [LOCAL-007] Preparar pipeline de homologação em nuvem pública (Vercel, AWS ou Fly.io)
|
|
10
|
+
|
|
11
|
+
## Em andamento (DOING)
|
|
12
|
+
(Nenhuma tarefa no momento — WIP limpo)
|
|
13
|
+
|
|
14
|
+
## Concluído (DONE)
|
|
15
|
+
- [x] [LOCAL-001] Implementar consolidação das regras de engenharia em 10 princípios canônicos (v4.1 Enterprise)
|
|
16
|
+
- [x] [LOCAL-002] Otimizar exportação de prompts para ferramentas externas (Claude, Windsurf, Cursor) via context_compressor
|
|
17
|
+
- [x] [LOCAL-003] Governança Dual-Agent e modo Offline-First no pipeline de desenvolvimento
|
|
18
|
+
- [x] [LOCAL-004] Reorganização modular da pasta scripts (arquitetura limpa: auditors, core, integrations, bin, mcp)
|
|
19
|
+
- [x] [LOCAL-005] Persistência real em SQLite nativo no MultiAgentOrchestrator
|
|
20
|
+
- [x] [LOCAL-006] Suíte adversária de fuzzing extremo e resiliência a ReDoS
|