ai-execution-protocol 0.1.0 → 0.2.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.
- package/AGENTS.md +4 -1
- package/README.md +37 -19
- package/dist/minimal/AGENTS.md +3 -1
- package/dist/minimal/canonical-state.yaml +14 -0
- package/dist/minimal/context-map.yaml +20 -0
- package/dist/minimal/decisions/README.md +7 -0
- package/dist/minimal/protocol/README.yaml +5 -1
- package/dist/minimal/protocol/context-compiler.yaml +21 -0
- package/dist/minimal/protocol/context-rules.yaml +16 -0
- package/dist/minimal/protocol/fast-path.yaml +1 -0
- package/dist/minimal/protocol/formatting-rules.yaml +27 -0
- package/dist/minimal/protocol/persistent-context.yaml +129 -0
- package/dist/minimal/protocol/risk-levels.yaml +18 -0
- package/dist/minimal/protocol/route-packs.yaml +153 -0
- package/dist/minimal/protocol/router.yaml +3 -0
- package/package.json +1 -1
- package/protocol/README.yaml +5 -1
- package/protocol/context-compiler.yaml +21 -0
- package/protocol/context-rules.yaml +16 -0
- package/protocol/fast-path.yaml +1 -0
- package/protocol/formatting-rules.yaml +27 -0
- package/protocol/persistent-context.yaml +129 -0
- package/protocol/risk-levels.yaml +18 -0
- package/protocol/route-packs.yaml +153 -0
- package/protocol/router.yaml +3 -0
- package/scripts/build_dist.py +59 -1
- package/scripts/npm_install_protocol.js +76 -2
- package/scripts/verify_install.py +18 -0
package/AGENTS.md
CHANGED
|
@@ -24,7 +24,8 @@ metodologia. Para executar tarefas, prefira as regras curtas em `protocol/`.
|
|
|
24
24
|
|
|
25
25
|
1. `protocol/fast-path.yaml`
|
|
26
26
|
2. `protocol/router.yaml`
|
|
27
|
-
3.
|
|
27
|
+
3. `protocol/route-packs.yaml` para ler o resumo compacto da rota.
|
|
28
|
+
4. Arquivo YAML especifico em `protocol/` somente quando o pack nao bastar:
|
|
28
29
|
- `README.yaml`
|
|
29
30
|
- `modes.yaml`
|
|
30
31
|
- `execution-rules.yaml`
|
|
@@ -33,6 +34,7 @@ metodologia. Para executar tarefas, prefira as regras curtas em `protocol/`.
|
|
|
33
34
|
- `validation-checklist.yaml`
|
|
34
35
|
- `context-rules.yaml`
|
|
35
36
|
- `context-compiler.yaml`
|
|
37
|
+
- `route-packs.yaml`
|
|
36
38
|
- `formatting-rules.yaml`
|
|
37
39
|
- `prompt-economy.yaml`
|
|
38
40
|
- `spec-driven.yaml`
|
|
@@ -54,6 +56,7 @@ metodologia. Para executar tarefas, prefira as regras curtas em `protocol/`.
|
|
|
54
56
|
- Classifique o risco antes de agir.
|
|
55
57
|
- Use o menor contexto suficiente.
|
|
56
58
|
- Leia apenas os arquivos indicados por `protocol/router.yaml`.
|
|
59
|
+
- Use `protocol/route-packs.yaml` antes de abrir todos os arquivos da rota.
|
|
57
60
|
- Quando houver contexto grande, historico longo ou risco de confusao, use
|
|
58
61
|
`protocol/context-compiler.yaml` antes de abrir muitos arquivos.
|
|
59
62
|
- Siga `.aiignore` e `INDEX.yaml/read_policy.ignore_by_default` antes de abrir
|
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ O framework ajuda a IA a:
|
|
|
14
14
|
|
|
15
15
|
- entender a intencao antes de agir;
|
|
16
16
|
- classificar o risco da tarefa;
|
|
17
|
+
- localizar o dominio certo antes de abrir arquivos grandes;
|
|
17
18
|
- ler apenas o contexto necessario;
|
|
18
19
|
- mapear impacto antes de alterar arquivos;
|
|
19
20
|
- pedir confirmacao em acoes sensiveis;
|
|
@@ -30,6 +31,16 @@ O protocolo nao tenta transformar toda tarefa em um processo pesado. A regra e
|
|
|
30
31
|
proporcionalidade: tarefa simples deve ser rapida; tarefa critica exige mais
|
|
31
32
|
mapa, confirmacao e evidencia.
|
|
32
33
|
|
|
34
|
+
Na v0.2.0, o framework adiciona uma camada leve de contexto persistente:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
pedido -> intencao -> dominio -> contexto minimo -> validacao -> acao
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Essa camada usa `canonical-state.yaml`, `context-map.yaml`, `decisions/` e
|
|
41
|
+
`protocol/persistent-context.yaml` para reduzir leitura desnecessaria. Ela e um
|
|
42
|
+
bootstrap seguro, nao um indexador automatico completo.
|
|
43
|
+
|
|
33
44
|
## Status
|
|
34
45
|
|
|
35
46
|
Projeto em fase de pesquisa e evolucao.
|
|
@@ -42,9 +53,13 @@ continuam obrigatorios em tarefas criticas.
|
|
|
42
53
|
|
|
43
54
|
- `AGENTS.md`: instrucao principal para agentes no projeto.
|
|
44
55
|
- `INDEX.yaml`: mapa estruturado para navegacao rapida.
|
|
56
|
+
- `canonical-state.yaml`: estado atual resumido e ordem de verdade.
|
|
57
|
+
- `context-map.yaml`: mapa pequeno de dominios, aliases e arquivos candidatos.
|
|
45
58
|
- `config.yaml`: configuracao do alvo atual e versao do protocolo.
|
|
59
|
+
- `decisions/`: decisoes importantes com status.
|
|
46
60
|
- `docs/`: explicacoes conceituais em Markdown.
|
|
47
61
|
- `protocol/`: regras operacionais curtas em YAML.
|
|
62
|
+
- `protocol/route-packs.yaml`: resumos compactos para reduzir leitura por rota.
|
|
48
63
|
- `cases/`: casos estruturados para testar o comportamento da IA.
|
|
49
64
|
- `examples/`: exemplos humanos de uso do framework.
|
|
50
65
|
- `schema/`: contratos para manter os YAML padronizados.
|
|
@@ -59,11 +74,25 @@ continuam obrigatorios em tarefas criticas.
|
|
|
59
74
|
## Como usar como agente
|
|
60
75
|
|
|
61
76
|
1. Leia `INDEX.yaml`.
|
|
62
|
-
2. Confirme o
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
2. Confirme o estado atual em `canonical-state.yaml` quando a verdade do
|
|
78
|
+
projeto importar.
|
|
79
|
+
3. Use `context-map.yaml` para localizar dominio e aliases provaveis.
|
|
80
|
+
4. Confirme o alvo atual em `config.yaml`.
|
|
81
|
+
5. Leia `protocol/fast-path.yaml`.
|
|
82
|
+
6. Use `protocol/router.yaml` para escolher o menor contexto suficiente.
|
|
83
|
+
7. Consulte `protocol/route-packs.yaml` antes de abrir todos os YAML da rota.
|
|
84
|
+
8. Abra arquivos completos apenas quando o resumo compacto nao bastar.
|
|
85
|
+
9. Execute, valide e entregue com evidencia.
|
|
86
|
+
|
|
87
|
+
Regra de seguranca da v0.2.0:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
A IA pode expandir contexto.
|
|
91
|
+
A IA nao pode expandir escopo.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Aliases, mapas e decisoes ajudam a navegar. Eles nao substituem verificacao no
|
|
95
|
+
codigo ou nos arquivos atuais antes de alterar comportamento.
|
|
67
96
|
|
|
68
97
|
## Como estudar o framework
|
|
69
98
|
|
|
@@ -73,8 +102,10 @@ Comece por:
|
|
|
73
102
|
- `docs/01-modelo-de-execucao.md`
|
|
74
103
|
- `docs/02-niveis-de-risco.md`
|
|
75
104
|
- `docs/03-mapeamento-antes-de-alterar.md`
|
|
105
|
+
- `docs/04-janela-de-contexto.md`
|
|
76
106
|
- `docs/05-validacao-e-entrega.md`
|
|
77
|
-
- `docs/
|
|
107
|
+
- `docs/15-contexto-persistente.md`
|
|
108
|
+
- `docs/17-documentacao-atomica.md`
|
|
78
109
|
|
|
79
110
|
Use `docs/` para entender a metodologia. Use `protocol/` quando quiser aplicar
|
|
80
111
|
as regras em uma tarefa real.
|
|
@@ -141,19 +172,6 @@ python scripts/verify_install.py --target C:\caminho\projeto
|
|
|
141
172
|
|
|
142
173
|
O final esperado da verificacao e `PASS`.
|
|
143
174
|
|
|
144
|
-
## Publicacao
|
|
145
|
-
|
|
146
|
-
Antes de publicar, revise `docs/14-publicacao.md`.
|
|
147
|
-
|
|
148
|
-
Resumo minimo:
|
|
149
|
-
|
|
150
|
-
- nao publique `.env`, chaves, tokens, senhas, logs reais ou dados de cliente;
|
|
151
|
-
- mantenha artefatos gerados fora do Git quando nao forem necessarios;
|
|
152
|
-
- use `.gitignore`;
|
|
153
|
-
- publique com `README.md`, `LICENSE`, `docs/`, `protocol/`, `cases/`,
|
|
154
|
-
`examples/`, `schema/`, `eval/` e `scripts/` quando fizer sentido;
|
|
155
|
-
- preserve o posicionamento como pesquisa experimental e framework em evolucao.
|
|
156
|
-
|
|
157
175
|
## Licenca
|
|
158
176
|
|
|
159
177
|
Distribuido sob a licenca MIT. Veja `LICENSE`.
|
package/dist/minimal/AGENTS.md
CHANGED
|
@@ -15,13 +15,15 @@ editar, classifique risco, escolha rota e valide a entrega.
|
|
|
15
15
|
|
|
16
16
|
1. `protocol/fast-path.yaml`
|
|
17
17
|
2. `protocol/router.yaml`
|
|
18
|
-
3.
|
|
18
|
+
3. `protocol/route-packs.yaml` para ler o resumo compacto da rota.
|
|
19
|
+
4. Arquivo YAML especifico em `protocol/` somente quando o pack nao bastar.
|
|
19
20
|
|
|
20
21
|
## Regras de execucao
|
|
21
22
|
|
|
22
23
|
- Classifique o risco antes de agir.
|
|
23
24
|
- Use o menor contexto suficiente.
|
|
24
25
|
- Leia apenas os arquivos indicados por `protocol/router.yaml`.
|
|
26
|
+
- Use `protocol/route-packs.yaml` antes de abrir todos os arquivos da rota.
|
|
25
27
|
- Quando houver contexto grande, historico longo ou risco de confusao, use
|
|
26
28
|
`protocol/context-compiler.yaml` antes de abrir muitos arquivos.
|
|
27
29
|
- Use `protocol/spec-driven.yaml` para feature, refatoracao grande ou tarefa
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
id: canonical_state
|
|
2
|
+
type: project_state
|
|
3
|
+
version: 0.1
|
|
4
|
+
purpose: small_current_truth_summary_for_ai_navigation
|
|
5
|
+
status: bootstrap_template
|
|
6
|
+
truth_order:
|
|
7
|
+
- current_user_request
|
|
8
|
+
- verified_current_files
|
|
9
|
+
- protocol_rules
|
|
10
|
+
- project_docs
|
|
11
|
+
- conversation_history
|
|
12
|
+
notes:
|
|
13
|
+
- update_this_file_when_project_state_or_decisions_change
|
|
14
|
+
- do_not_treat_this_file_as_truth_without_current_file_verification
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
id: project_context_map
|
|
2
|
+
type: context_map
|
|
3
|
+
version: 0.1
|
|
4
|
+
purpose: small_index_for_progressive_context_retrieval
|
|
5
|
+
maintenance:
|
|
6
|
+
current_mode: manual_bootstrap
|
|
7
|
+
rule: aliases_are_pointers_not_truth
|
|
8
|
+
read_first:
|
|
9
|
+
- canonical-state.yaml
|
|
10
|
+
- protocol/fast-path.yaml
|
|
11
|
+
- protocol/router.yaml
|
|
12
|
+
- protocol/route-packs.yaml
|
|
13
|
+
domains: {}
|
|
14
|
+
retrieval_policy:
|
|
15
|
+
order:
|
|
16
|
+
- match_domain_by_alias
|
|
17
|
+
- read_domain_docs_only_when_needed
|
|
18
|
+
- search_candidate_files_or_symbols
|
|
19
|
+
- read_relevant_snippet_first
|
|
20
|
+
- read_full_file_when_snippet_is_not_enough
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
id: protocol_index
|
|
2
2
|
type: index
|
|
3
3
|
format: yaml
|
|
4
|
-
protocol_version: 0.1
|
|
4
|
+
protocol_version: 0.2.1
|
|
5
5
|
purpose: ai_operational_rules
|
|
6
6
|
source_docs: ../docs
|
|
7
7
|
constraints:
|
|
@@ -13,6 +13,8 @@ files:
|
|
|
13
13
|
purpose: minimum_rules_to_start_any_task
|
|
14
14
|
- path: router.yaml
|
|
15
15
|
purpose: choose_minimum_files_to_read_by_task
|
|
16
|
+
- path: route-packs.yaml
|
|
17
|
+
purpose: compact_first_read_before_full_route_files
|
|
16
18
|
- path: modes.yaml
|
|
17
19
|
purpose: choose_fast_balanced_or_strict_behavior
|
|
18
20
|
- path: execution-rules.yaml
|
|
@@ -27,6 +29,8 @@ files:
|
|
|
27
29
|
purpose: context_window_file_size_memory
|
|
28
30
|
- path: context-compiler.yaml
|
|
29
31
|
purpose: compile_minimum_context_package_and_canonical_state
|
|
32
|
+
- path: persistent-context.yaml
|
|
33
|
+
purpose: progressive_context_retrieval_with_aliases
|
|
30
34
|
- path: formatting-rules.yaml
|
|
31
35
|
purpose: ai_readable_file_format
|
|
32
36
|
- path: prompt-economy.yaml
|
|
@@ -6,6 +6,8 @@ principle: conversation_is_interface_not_source_of_truth
|
|
|
6
6
|
canonical_state:
|
|
7
7
|
read_first:
|
|
8
8
|
- AGENTS.md
|
|
9
|
+
- canonical-state.yaml
|
|
10
|
+
- context-map.yaml
|
|
9
11
|
- INDEX.yaml
|
|
10
12
|
- config.yaml
|
|
11
13
|
- protocol/fast-path.yaml
|
|
@@ -37,6 +39,8 @@ context_build:
|
|
|
37
39
|
- excluded_context
|
|
38
40
|
selection_policy:
|
|
39
41
|
include:
|
|
42
|
+
- context_map_domain_when_available
|
|
43
|
+
- active_decisions_for_matched_domain
|
|
40
44
|
- files_required_by_route
|
|
41
45
|
- snippets_matching_task_terms
|
|
42
46
|
- current_decisions_touching_candidate_area
|
|
@@ -81,9 +85,19 @@ decision_rules:
|
|
|
81
85
|
when: context_gap_blocks_safe_execution
|
|
82
86
|
do:
|
|
83
87
|
- ask_one_short_question_or_read_next_mapped_file
|
|
88
|
+
- id: CTX_005
|
|
89
|
+
when: alias_or_snippet_seems_sufficient
|
|
90
|
+
do:
|
|
91
|
+
- verify_against_current_file_state_before_editing
|
|
92
|
+
- escalate_to_full_file_when_imports_types_or_side_effects_matter
|
|
93
|
+
avoid:
|
|
94
|
+
- treating_alias_as_source_of_truth
|
|
95
|
+
- editing_from_snippet_when_behavior_depends_on_unread_context
|
|
84
96
|
retrieval_tiers:
|
|
85
97
|
mvp:
|
|
86
98
|
use:
|
|
99
|
+
- canonical-state.yaml
|
|
100
|
+
- context-map.yaml
|
|
87
101
|
- INDEX.yaml
|
|
88
102
|
- router.yaml
|
|
89
103
|
- targeted_search
|
|
@@ -108,3 +122,10 @@ delivery:
|
|
|
108
122
|
- context_used
|
|
109
123
|
- context_excluded
|
|
110
124
|
- reason_for_not_reading_more
|
|
125
|
+
economy_goal:
|
|
126
|
+
target: reduce_unneeded_context_up_to_90_percent_when_safe
|
|
127
|
+
never_trade_off:
|
|
128
|
+
- correctness
|
|
129
|
+
- security
|
|
130
|
+
- validation
|
|
131
|
+
- risk_classification
|
|
@@ -4,6 +4,9 @@ version: 0.1
|
|
|
4
4
|
context_policy:
|
|
5
5
|
use: minimum_sufficient_context
|
|
6
6
|
prefer:
|
|
7
|
+
- context_map_before_domain_docs
|
|
8
|
+
- atomic_subject_docs_before_broad_docs
|
|
9
|
+
- aliases_for_search_not_truth
|
|
7
10
|
- targeted_search
|
|
8
11
|
- relevant_snippets
|
|
9
12
|
- current_state_over_old_history
|
|
@@ -13,12 +16,25 @@ context_policy:
|
|
|
13
16
|
- repeating_long_rules_in_chat
|
|
14
17
|
- mixing_old_and_current_docs
|
|
15
18
|
- treating_conversation_as_source_of_truth
|
|
19
|
+
- treating_aliases_as_verified_behavior
|
|
20
|
+
- reading_broad_docs_when_atomic_subject_doc_exists
|
|
16
21
|
file_size:
|
|
17
22
|
max_lines: 400
|
|
18
23
|
when_near_limit:
|
|
19
24
|
- split_by_subject
|
|
20
25
|
- keep_main_file_short
|
|
21
26
|
- update_index
|
|
27
|
+
subject_docs:
|
|
28
|
+
rule: docs_should_be_grouped_by_searchable_subject_not_only_by_size
|
|
29
|
+
do:
|
|
30
|
+
- create_or_update_one_doc_per_domain_flow_decision_or_component
|
|
31
|
+
- use_filename_terms_that_match_likely_user_requests_and_code_symbols
|
|
32
|
+
- use_rg_to_find_exact_code_symbols_after_reading_subject_doc
|
|
33
|
+
- verify_code_before_treating_doc_as_truth
|
|
34
|
+
avoid:
|
|
35
|
+
- fragmenting_into_micro_docs_without_standalone_subject
|
|
36
|
+
- duplicating_same_subject_across_docs
|
|
37
|
+
- keeping_cross_domain_docs_without_links_to_specific_subject_docs
|
|
22
38
|
memory:
|
|
23
39
|
record:
|
|
24
40
|
- stable_decision
|
|
@@ -6,6 +6,7 @@ priority:
|
|
|
6
6
|
second: human_readability
|
|
7
7
|
principles:
|
|
8
8
|
- one_main_subject_per_file
|
|
9
|
+
- atomic_docs_by_trackable_subject
|
|
9
10
|
- stable_keys
|
|
10
11
|
- direct_names
|
|
11
12
|
- short_lists
|
|
@@ -73,3 +74,29 @@ maintenance:
|
|
|
73
74
|
if_near_limit:
|
|
74
75
|
- split_by_theme
|
|
75
76
|
- update_readme
|
|
77
|
+
atomic_documentation:
|
|
78
|
+
principle: one_file_one_trackable_subject
|
|
79
|
+
use_for:
|
|
80
|
+
- domain
|
|
81
|
+
- flow
|
|
82
|
+
- decision
|
|
83
|
+
- component
|
|
84
|
+
- integration
|
|
85
|
+
- validation_area
|
|
86
|
+
naming:
|
|
87
|
+
do:
|
|
88
|
+
- include_search_terms_in_filename
|
|
89
|
+
- prefer_domain_flow_or_component_names
|
|
90
|
+
- keep_titles_matching_filename_subject
|
|
91
|
+
avoid:
|
|
92
|
+
- generic_names_like_general_notes_part1
|
|
93
|
+
- duplicate_files_for_same_subject
|
|
94
|
+
- oversized_docs_with_multiple_unrelated_subjects
|
|
95
|
+
split_when:
|
|
96
|
+
- file_has_multiple_independent_subjects
|
|
97
|
+
- file_nears_line_limit
|
|
98
|
+
- rg_search_would_match_unrelated_sections
|
|
99
|
+
update_when_split:
|
|
100
|
+
- docs_readme
|
|
101
|
+
- index_or_context_map_when_relevant
|
|
102
|
+
- aliases_when_subject_terms_change
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
id: persistent_context
|
|
2
|
+
type: operational_rules
|
|
3
|
+
version: 0.2
|
|
4
|
+
purpose: navigate_project_memory_without_loading_unneeded_context
|
|
5
|
+
principle: aliases_are_pointers_not_truth
|
|
6
|
+
autonomous_memory:
|
|
7
|
+
target: generate_memory_from_project_state_without_manual_maintenance
|
|
8
|
+
current_safe_stage: bootstrap_with_small_verified_artifacts
|
|
9
|
+
promote_to_required_only_when:
|
|
10
|
+
- indexer_exists
|
|
11
|
+
- generated_output_is_reproducible
|
|
12
|
+
- stale_output_can_be_detected
|
|
13
|
+
- validation_passes_in_real_projects
|
|
14
|
+
economy_goal:
|
|
15
|
+
target: reduce_unneeded_context_up_to_90_percent_when_safe
|
|
16
|
+
meaning: reduce_irrelevant_context_not_required_context
|
|
17
|
+
stop_condition:
|
|
18
|
+
- objective_is_clear
|
|
19
|
+
- candidate_area_is_mapped
|
|
20
|
+
- validation_plan_is_clear
|
|
21
|
+
- no_unresolved_risk_requires_more_context
|
|
22
|
+
entrypoints:
|
|
23
|
+
- canonical-state.yaml
|
|
24
|
+
- context-map.yaml
|
|
25
|
+
- decisions/
|
|
26
|
+
progressive_retrieval:
|
|
27
|
+
order:
|
|
28
|
+
- identify_objective
|
|
29
|
+
- match_domain_or_alias_in_context_map
|
|
30
|
+
- read_canonical_state_when_project_truth_matters
|
|
31
|
+
- read_active_decisions_for_domain
|
|
32
|
+
- read_only_needed_atomic_subject_docs
|
|
33
|
+
- search_candidate_symbols_or_files
|
|
34
|
+
- read_relevant_snippet_first
|
|
35
|
+
- read_direct_dependencies_when_needed
|
|
36
|
+
- read_full_file_when_snippet_is_not_enough
|
|
37
|
+
confidence_policy:
|
|
38
|
+
high:
|
|
39
|
+
threshold: enough_context_to_act_and_validate
|
|
40
|
+
do:
|
|
41
|
+
- execute_with_current_context
|
|
42
|
+
medium:
|
|
43
|
+
threshold: likely_context_gap_or_adjacent_dependency
|
|
44
|
+
do:
|
|
45
|
+
- expand_one_retrieval_level
|
|
46
|
+
low:
|
|
47
|
+
threshold: ambiguous_intent_or_missing_target
|
|
48
|
+
do:
|
|
49
|
+
- ask_clarifying_question
|
|
50
|
+
context_validator:
|
|
51
|
+
check:
|
|
52
|
+
- enough_context_for_objective
|
|
53
|
+
- active_decisions_loaded_when_relevant
|
|
54
|
+
- direct_dependencies_loaded_when_needed
|
|
55
|
+
- adjacent_domain_risk_checked
|
|
56
|
+
- docs_do_not_conflict_with_verified_files
|
|
57
|
+
if_gap_found:
|
|
58
|
+
- expand_context_not_scope
|
|
59
|
+
action_validator:
|
|
60
|
+
require:
|
|
61
|
+
- target_is_identified
|
|
62
|
+
- expected_result_is_clear
|
|
63
|
+
- impact_is_mapped_for_level_2_or_3
|
|
64
|
+
- validation_plan_exists
|
|
65
|
+
if_intent_is_ambiguous:
|
|
66
|
+
- ask_user_before_editing
|
|
67
|
+
rule: context_can_expand_scope_cannot_expand
|
|
68
|
+
alias_policy:
|
|
69
|
+
use_aliases_for:
|
|
70
|
+
- domain_routing
|
|
71
|
+
- symbol_search_terms
|
|
72
|
+
- dependency_search_terms
|
|
73
|
+
- recent_context_labels
|
|
74
|
+
never_use_aliases_as:
|
|
75
|
+
- proof_of_current_behavior
|
|
76
|
+
- replacement_for_code_or_verified_files
|
|
77
|
+
- permission_to_edit_without_mapping
|
|
78
|
+
snippet_policy:
|
|
79
|
+
prefer:
|
|
80
|
+
- targeted_search
|
|
81
|
+
- symbol_or_function_snippet
|
|
82
|
+
- nearby_imports_types_and_callers_when_needed
|
|
83
|
+
read_full_file_when:
|
|
84
|
+
- imports_or_types_change_meaning
|
|
85
|
+
- side_effects_or_shared_state_matter
|
|
86
|
+
- snippet_boundaries_are_unclear
|
|
87
|
+
- edit_risk_is_level_2_or_3_and_file_is_candidate
|
|
88
|
+
conflict_policy:
|
|
89
|
+
order:
|
|
90
|
+
- current_user_request
|
|
91
|
+
- canonical_state
|
|
92
|
+
- active_decisions
|
|
93
|
+
- verified_code_or_files_this_turn
|
|
94
|
+
- domain_docs
|
|
95
|
+
- current_conversation
|
|
96
|
+
if_docs_conflict_with_code:
|
|
97
|
+
- trust_verified_code_for_behavior
|
|
98
|
+
- report_stale_doc_risk
|
|
99
|
+
validation:
|
|
100
|
+
require:
|
|
101
|
+
- state_context_used_when_relevant
|
|
102
|
+
- state_context_not_loaded_when_excluded_for_economy
|
|
103
|
+
- escalate_context_if_snippet_is_insufficient
|
|
104
|
+
- update_subject_index_when_docs_are_split
|
|
105
|
+
atomic_subject_flow:
|
|
106
|
+
order:
|
|
107
|
+
- identify_subject_terms_from_request
|
|
108
|
+
- find_subject_doc_by_context_map_index_or_rg
|
|
109
|
+
- read_subject_doc_before_broad_doc
|
|
110
|
+
- use_rg_for_exact_code_symbol_or_term
|
|
111
|
+
- read_code_snippet_first
|
|
112
|
+
- expand_to_full_file_or_related_doc_when_needed
|
|
113
|
+
failure_mitigations:
|
|
114
|
+
fragmentation:
|
|
115
|
+
- do_not_create_doc_for_micro_detail_without_standalone_subject
|
|
116
|
+
- merge_or_link_overlapping_docs
|
|
117
|
+
bad_names:
|
|
118
|
+
- include_domain_flow_component_or_symbol_terms_in_filename
|
|
119
|
+
duplicates:
|
|
120
|
+
- search_existing_docs_before_creating_new_doc
|
|
121
|
+
- prefer_updating_existing_subject_doc
|
|
122
|
+
stale_docs:
|
|
123
|
+
- verify_current_code_before_behavior_claim
|
|
124
|
+
- report_stale_doc_risk
|
|
125
|
+
wrong_search_terms:
|
|
126
|
+
- use_aliases_and_synonyms_as_search_terms
|
|
127
|
+
- search_docs_and_code_with_rg
|
|
128
|
+
insufficient_snippet:
|
|
129
|
+
- expand_to_imports_types_callers_or_full_file
|
|
@@ -65,6 +65,24 @@ levels:
|
|
|
65
65
|
escalation:
|
|
66
66
|
rule: raise_level_when_new_risk_evidence_appears
|
|
67
67
|
never: lower_level_by_ignoring_known_risk
|
|
68
|
+
proportional_classification:
|
|
69
|
+
principle: start_with_lowest_safe_level_and_escalate_only_with_evidence
|
|
70
|
+
do:
|
|
71
|
+
- classify_the_user_request_before_reading_large_context
|
|
72
|
+
- keep_scope_small_when_task_is_clear_and_reversible
|
|
73
|
+
- escalate_when_new_risk_evidence_appears
|
|
74
|
+
- classify_split_subtasks_by_their_own_executable_scope
|
|
75
|
+
avoid:
|
|
76
|
+
- treating_every_multi_step_task_as_level_3
|
|
77
|
+
- loading_critical_context_before_critical_risk_is_evident
|
|
78
|
+
- downgrading_known_risk_to_save_tokens
|
|
79
|
+
escalation_triggers:
|
|
80
|
+
- real_data_or_customer_data
|
|
81
|
+
- auth_or_permission_change
|
|
82
|
+
- database_or_destructive_command
|
|
83
|
+
- deploy_or_production_change
|
|
84
|
+
- secrets_or_tokens
|
|
85
|
+
- unclear_impact_on_existing_flow
|
|
68
86
|
blocked_critical_scope:
|
|
69
87
|
principle: do_not_lower_original_risk_because_sensitive_action_is_blocked
|
|
70
88
|
when:
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
id: route_packs
|
|
2
|
+
type: route_summary_index
|
|
3
|
+
version: 0.1
|
|
4
|
+
purpose: compact_first_read_before_full_route_files
|
|
5
|
+
principle: read_pack_first_expand_only_when_needed
|
|
6
|
+
use:
|
|
7
|
+
- after_router_selects_route
|
|
8
|
+
- before_opening_all_route_files
|
|
9
|
+
- when_task_is_clear_enough_for_compact_rules
|
|
10
|
+
expand_when:
|
|
11
|
+
- risk_or_scope_is_unclear
|
|
12
|
+
- validation_plan_is_not_clear
|
|
13
|
+
- route_pack_conflicts_with_user_request
|
|
14
|
+
- task_is_level_2_or_3_and_impact_is_not_mapped
|
|
15
|
+
- yaml_schema_or_exact_rule_text_is_needed
|
|
16
|
+
packs:
|
|
17
|
+
simple_answer:
|
|
18
|
+
risk: 0
|
|
19
|
+
read_if_pack_insufficient:
|
|
20
|
+
- fast-path.yaml
|
|
21
|
+
do:
|
|
22
|
+
- answer_directly
|
|
23
|
+
- avoid_plan_or_file_reads
|
|
24
|
+
- keep_po_pm_ok_short_when_required
|
|
25
|
+
small_fix:
|
|
26
|
+
risk: 1
|
|
27
|
+
read_if_pack_insufficient:
|
|
28
|
+
- fast-path.yaml
|
|
29
|
+
- validation-checklist.yaml
|
|
30
|
+
do:
|
|
31
|
+
- identify_small_reversible_target
|
|
32
|
+
- read_focused_context
|
|
33
|
+
- change_minimum_needed
|
|
34
|
+
- validate_directly
|
|
35
|
+
user_flow_bug:
|
|
36
|
+
risk: 2
|
|
37
|
+
read_if_pack_insufficient:
|
|
38
|
+
- context-compiler.yaml
|
|
39
|
+
- risk-levels.yaml
|
|
40
|
+
- mapping-checklists.yaml
|
|
41
|
+
- validation-checklist.yaml
|
|
42
|
+
do:
|
|
43
|
+
- map_flow_candidate_files_and_regression_risk
|
|
44
|
+
- read_snippets_before_full_files
|
|
45
|
+
- preserve_expected_behavior
|
|
46
|
+
- validate_main_success_and_failure_paths
|
|
47
|
+
refactor:
|
|
48
|
+
risk: 2
|
|
49
|
+
read_if_pack_insufficient:
|
|
50
|
+
- context-compiler.yaml
|
|
51
|
+
- mapping-checklists.yaml
|
|
52
|
+
- validation-checklist.yaml
|
|
53
|
+
- spec-driven.yaml
|
|
54
|
+
do:
|
|
55
|
+
- define_behavior_to_preserve
|
|
56
|
+
- keep_scope_incremental
|
|
57
|
+
- avoid_new_features
|
|
58
|
+
- validate_behavior_after_change
|
|
59
|
+
feature_or_spec:
|
|
60
|
+
risk: 2
|
|
61
|
+
read_if_pack_insufficient:
|
|
62
|
+
- context-compiler.yaml
|
|
63
|
+
- risk-levels.yaml
|
|
64
|
+
- mapping-checklists.yaml
|
|
65
|
+
- validation-checklist.yaml
|
|
66
|
+
- spec-driven.yaml
|
|
67
|
+
do:
|
|
68
|
+
- use_light_spec_when_scope_or_risk_benefits
|
|
69
|
+
- define_objective_scope_validation
|
|
70
|
+
- implement_incrementally
|
|
71
|
+
- avoid_full_spec_for_small_clear_tasks
|
|
72
|
+
docs_update:
|
|
73
|
+
risk: 1
|
|
74
|
+
read_if_pack_insufficient:
|
|
75
|
+
- context-rules.yaml
|
|
76
|
+
- formatting-rules.yaml
|
|
77
|
+
do:
|
|
78
|
+
- update_only_affected_docs
|
|
79
|
+
- keep_docs_atomic_by_subject
|
|
80
|
+
- verify_links_or_references
|
|
81
|
+
- update_index_when_structure_changes
|
|
82
|
+
database_or_data:
|
|
83
|
+
risk: 3
|
|
84
|
+
read_if_pack_insufficient:
|
|
85
|
+
- context-compiler.yaml
|
|
86
|
+
- risk-levels.yaml
|
|
87
|
+
- mapping-checklists.yaml
|
|
88
|
+
- validation-checklist.yaml
|
|
89
|
+
- spec-driven.yaml
|
|
90
|
+
do:
|
|
91
|
+
- map_affected_data
|
|
92
|
+
- avoid_destructive_action_without_confirmation
|
|
93
|
+
- define_backup_or_rollback
|
|
94
|
+
- validate_before_and_after
|
|
95
|
+
auth_security_secret:
|
|
96
|
+
risk: 3
|
|
97
|
+
read_if_pack_insufficient:
|
|
98
|
+
- context-compiler.yaml
|
|
99
|
+
- risk-levels.yaml
|
|
100
|
+
- mapping-checklists.yaml
|
|
101
|
+
- validation-checklist.yaml
|
|
102
|
+
- spec-driven.yaml
|
|
103
|
+
do:
|
|
104
|
+
- map_security_surface
|
|
105
|
+
- avoid_exposing_secrets
|
|
106
|
+
- require_confirmation_for_sensitive_write
|
|
107
|
+
- validate_allowed_and_denied_paths
|
|
108
|
+
deploy_or_production:
|
|
109
|
+
risk: 3
|
|
110
|
+
read_if_pack_insufficient:
|
|
111
|
+
- context-compiler.yaml
|
|
112
|
+
- risk-levels.yaml
|
|
113
|
+
- validation-checklist.yaml
|
|
114
|
+
- context-rules.yaml
|
|
115
|
+
- spec-driven.yaml
|
|
116
|
+
do:
|
|
117
|
+
- verify_local_state
|
|
118
|
+
- run_pre_deploy_validation
|
|
119
|
+
- require_confirmation_before_deploy
|
|
120
|
+
- run_post_deploy_check_if_executed
|
|
121
|
+
evaluate_response:
|
|
122
|
+
read_if_pack_insufficient:
|
|
123
|
+
- ../eval/rubric.yaml
|
|
124
|
+
- ../schema/evaluated-response.schema.json
|
|
125
|
+
do:
|
|
126
|
+
- score_risk_behavior_avoidance_delivery_clarity
|
|
127
|
+
- apply_automatic_fail_rules
|
|
128
|
+
create_or_edit_yaml:
|
|
129
|
+
read_if_pack_insufficient:
|
|
130
|
+
- formatting-rules.yaml
|
|
131
|
+
- ../schema/protocol-rule.schema.yaml
|
|
132
|
+
do:
|
|
133
|
+
- keep_yaml_compact
|
|
134
|
+
- validate_schema_when_available
|
|
135
|
+
- update_index_when_new_file_is_added
|
|
136
|
+
prompt_improvement:
|
|
137
|
+
read_if_pack_insufficient:
|
|
138
|
+
- prompt-economy.yaml
|
|
139
|
+
do:
|
|
140
|
+
- preserve_user_intent
|
|
141
|
+
- improve_only_as_much_as_needed
|
|
142
|
+
- keep_prompt_proportional_to_risk
|
|
143
|
+
- avoid_long_specs_for_simple_tasks
|
|
144
|
+
context_optimization:
|
|
145
|
+
read_if_pack_insufficient:
|
|
146
|
+
- persistent-context.yaml
|
|
147
|
+
- context-rules.yaml
|
|
148
|
+
- context-compiler.yaml
|
|
149
|
+
do:
|
|
150
|
+
- use_context_map_and_aliases_as_pointers
|
|
151
|
+
- read_atomic_subject_doc_before_broad_doc
|
|
152
|
+
- search_with_rg_before_full_file_reads
|
|
153
|
+
- expand_context_without_expanding_scope
|
|
@@ -90,11 +90,14 @@ routes:
|
|
|
90
90
|
context_optimization:
|
|
91
91
|
read:
|
|
92
92
|
- fast-path.yaml
|
|
93
|
+
- persistent-context.yaml
|
|
93
94
|
- context-rules.yaml
|
|
94
95
|
- context-compiler.yaml
|
|
95
96
|
rules:
|
|
96
97
|
- start_with_default_read
|
|
97
98
|
- choose_one_route_if_task_type_is_clear
|
|
99
|
+
- read_route_pack_before_full_route_files_when_available
|
|
100
|
+
- expand_from_route_pack_only_when_needed
|
|
98
101
|
- if_route_unclear_read_risk_levels_then_choose_route
|
|
99
102
|
- do_not_read_docs_unless_protocol_is_insufficient
|
|
100
103
|
- do_not_read_cases_unless_testing_or_comparing_behavior
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-execution-protocol",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Experimental AI execution protocol for safer agent workflows, minimal context, risk classification, validation, and evidence-based delivery.",
|
|
6
6
|
"license": "MIT",
|