ai-execution-protocol 0.2.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 +5 -18
- 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 +3 -1
- package/dist/minimal/protocol/context-rules.yaml +13 -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 +27 -1
- package/dist/minimal/protocol/route-packs.yaml +153 -0
- package/dist/minimal/protocol/router.yaml +2 -0
- package/package.json +1 -1
- package/protocol/README.yaml +3 -1
- package/protocol/context-rules.yaml +13 -0
- package/protocol/fast-path.yaml +1 -0
- package/protocol/formatting-rules.yaml +27 -0
- package/protocol/persistent-context.yaml +27 -1
- package/protocol/route-packs.yaml +153 -0
- package/protocol/router.yaml +2 -0
- package/scripts/build_dist.py +58 -1
- package/scripts/npm_install_protocol.js +75 -2
- package/scripts/verify_install.py +17 -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
|
@@ -59,6 +59,7 @@ continuam obrigatorios em tarefas criticas.
|
|
|
59
59
|
- `decisions/`: decisoes importantes com status.
|
|
60
60
|
- `docs/`: explicacoes conceituais em Markdown.
|
|
61
61
|
- `protocol/`: regras operacionais curtas em YAML.
|
|
62
|
+
- `protocol/route-packs.yaml`: resumos compactos para reduzir leitura por rota.
|
|
62
63
|
- `cases/`: casos estruturados para testar o comportamento da IA.
|
|
63
64
|
- `examples/`: exemplos humanos de uso do framework.
|
|
64
65
|
- `schema/`: contratos para manter os YAML padronizados.
|
|
@@ -79,8 +80,9 @@ continuam obrigatorios em tarefas criticas.
|
|
|
79
80
|
4. Confirme o alvo atual em `config.yaml`.
|
|
80
81
|
5. Leia `protocol/fast-path.yaml`.
|
|
81
82
|
6. Use `protocol/router.yaml` para escolher o menor contexto suficiente.
|
|
82
|
-
7.
|
|
83
|
-
8.
|
|
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.
|
|
84
86
|
|
|
85
87
|
Regra de seguranca da v0.2.0:
|
|
86
88
|
|
|
@@ -103,8 +105,7 @@ Comece por:
|
|
|
103
105
|
- `docs/04-janela-de-contexto.md`
|
|
104
106
|
- `docs/05-validacao-e-entrega.md`
|
|
105
107
|
- `docs/15-contexto-persistente.md`
|
|
106
|
-
- `docs/
|
|
107
|
-
- `docs/16-release-e-atualizacao.md`
|
|
108
|
+
- `docs/17-documentacao-atomica.md`
|
|
108
109
|
|
|
109
110
|
Use `docs/` para entender a metodologia. Use `protocol/` quando quiser aplicar
|
|
110
111
|
as regras em uma tarefa real.
|
|
@@ -171,20 +172,6 @@ python scripts/verify_install.py --target C:\caminho\projeto
|
|
|
171
172
|
|
|
172
173
|
O final esperado da verificacao e `PASS`.
|
|
173
174
|
|
|
174
|
-
## Publicacao
|
|
175
|
-
|
|
176
|
-
Antes de publicar, revise `docs/14-publicacao.md`.
|
|
177
|
-
Para atualizar uma versao ja publicada, revise `docs/16-release-e-atualizacao.md`.
|
|
178
|
-
|
|
179
|
-
Resumo minimo:
|
|
180
|
-
|
|
181
|
-
- nao publique `.env`, chaves, tokens, senhas, logs reais ou dados de cliente;
|
|
182
|
-
- mantenha artefatos gerados fora do Git quando nao forem necessarios;
|
|
183
|
-
- use `.gitignore`;
|
|
184
|
-
- publique com `README.md`, `LICENSE`, `docs/`, `protocol/`, `cases/`,
|
|
185
|
-
`examples/`, `schema/`, `eval/` e `scripts/` quando fizer sentido;
|
|
186
|
-
- preserve o posicionamento como pesquisa experimental e framework em evolucao.
|
|
187
|
-
|
|
188
175
|
## Licenca
|
|
189
176
|
|
|
190
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.2.
|
|
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
|
|
@@ -5,6 +5,7 @@ context_policy:
|
|
|
5
5
|
use: minimum_sufficient_context
|
|
6
6
|
prefer:
|
|
7
7
|
- context_map_before_domain_docs
|
|
8
|
+
- atomic_subject_docs_before_broad_docs
|
|
8
9
|
- aliases_for_search_not_truth
|
|
9
10
|
- targeted_search
|
|
10
11
|
- relevant_snippets
|
|
@@ -16,12 +17,24 @@ context_policy:
|
|
|
16
17
|
- mixing_old_and_current_docs
|
|
17
18
|
- treating_conversation_as_source_of_truth
|
|
18
19
|
- treating_aliases_as_verified_behavior
|
|
20
|
+
- reading_broad_docs_when_atomic_subject_doc_exists
|
|
19
21
|
file_size:
|
|
20
22
|
max_lines: 400
|
|
21
23
|
when_near_limit:
|
|
22
24
|
- split_by_subject
|
|
23
25
|
- keep_main_file_short
|
|
24
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
|
|
25
38
|
memory:
|
|
26
39
|
record:
|
|
27
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
|
|
@@ -29,7 +29,7 @@ progressive_retrieval:
|
|
|
29
29
|
- match_domain_or_alias_in_context_map
|
|
30
30
|
- read_canonical_state_when_project_truth_matters
|
|
31
31
|
- read_active_decisions_for_domain
|
|
32
|
-
-
|
|
32
|
+
- read_only_needed_atomic_subject_docs
|
|
33
33
|
- search_candidate_symbols_or_files
|
|
34
34
|
- read_relevant_snippet_first
|
|
35
35
|
- read_direct_dependencies_when_needed
|
|
@@ -101,3 +101,29 @@ validation:
|
|
|
101
101
|
- state_context_used_when_relevant
|
|
102
102
|
- state_context_not_loaded_when_excluded_for_economy
|
|
103
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
|
|
@@ -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
|
|
@@ -96,6 +96,8 @@ routes:
|
|
|
96
96
|
rules:
|
|
97
97
|
- start_with_default_read
|
|
98
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
|
|
99
101
|
- if_route_unclear_read_risk_levels_then_choose_route
|
|
100
102
|
- do_not_read_docs_unless_protocol_is_insufficient
|
|
101
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.2.
|
|
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",
|
package/protocol/README.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
id: protocol_index
|
|
2
2
|
type: index
|
|
3
3
|
format: yaml
|
|
4
|
-
protocol_version: 0.2.
|
|
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
|
|
@@ -5,6 +5,7 @@ context_policy:
|
|
|
5
5
|
use: minimum_sufficient_context
|
|
6
6
|
prefer:
|
|
7
7
|
- context_map_before_domain_docs
|
|
8
|
+
- atomic_subject_docs_before_broad_docs
|
|
8
9
|
- aliases_for_search_not_truth
|
|
9
10
|
- targeted_search
|
|
10
11
|
- relevant_snippets
|
|
@@ -16,12 +17,24 @@ context_policy:
|
|
|
16
17
|
- mixing_old_and_current_docs
|
|
17
18
|
- treating_conversation_as_source_of_truth
|
|
18
19
|
- treating_aliases_as_verified_behavior
|
|
20
|
+
- reading_broad_docs_when_atomic_subject_doc_exists
|
|
19
21
|
file_size:
|
|
20
22
|
max_lines: 400
|
|
21
23
|
when_near_limit:
|
|
22
24
|
- split_by_subject
|
|
23
25
|
- keep_main_file_short
|
|
24
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
|
|
25
38
|
memory:
|
|
26
39
|
record:
|
|
27
40
|
- stable_decision
|
package/protocol/fast-path.yaml
CHANGED
|
@@ -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
|
|
@@ -29,7 +29,7 @@ progressive_retrieval:
|
|
|
29
29
|
- match_domain_or_alias_in_context_map
|
|
30
30
|
- read_canonical_state_when_project_truth_matters
|
|
31
31
|
- read_active_decisions_for_domain
|
|
32
|
-
-
|
|
32
|
+
- read_only_needed_atomic_subject_docs
|
|
33
33
|
- search_candidate_symbols_or_files
|
|
34
34
|
- read_relevant_snippet_first
|
|
35
35
|
- read_direct_dependencies_when_needed
|
|
@@ -101,3 +101,29 @@ validation:
|
|
|
101
101
|
- state_context_used_when_relevant
|
|
102
102
|
- state_context_not_loaded_when_excluded_for_economy
|
|
103
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
|
|
@@ -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
|
package/protocol/router.yaml
CHANGED
|
@@ -96,6 +96,8 @@ routes:
|
|
|
96
96
|
rules:
|
|
97
97
|
- start_with_default_read
|
|
98
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
|
|
99
101
|
- if_route_unclear_read_risk_levels_then_choose_route
|
|
100
102
|
- do_not_read_docs_unless_protocol_is_insufficient
|
|
101
103
|
- do_not_read_cases_unless_testing_or_comparing_behavior
|
package/scripts/build_dist.py
CHANGED
|
@@ -16,6 +16,7 @@ PROTOCOL_FILES = [
|
|
|
16
16
|
"README.yaml",
|
|
17
17
|
"fast-path.yaml",
|
|
18
18
|
"router.yaml",
|
|
19
|
+
"route-packs.yaml",
|
|
19
20
|
"modes.yaml",
|
|
20
21
|
"execution-rules.yaml",
|
|
21
22
|
"risk-levels.yaml",
|
|
@@ -47,13 +48,15 @@ editar, classifique risco, escolha rota e valide a entrega.
|
|
|
47
48
|
|
|
48
49
|
1. `protocol/fast-path.yaml`
|
|
49
50
|
2. `protocol/router.yaml`
|
|
50
|
-
3.
|
|
51
|
+
3. `protocol/route-packs.yaml` para ler o resumo compacto da rota.
|
|
52
|
+
4. Arquivo YAML especifico em `protocol/` somente quando o pack nao bastar.
|
|
51
53
|
|
|
52
54
|
## Regras de execucao
|
|
53
55
|
|
|
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
|
- Use `protocol/spec-driven.yaml` para feature, refatoracao grande ou tarefa
|
|
@@ -168,6 +171,56 @@ scripts/__pycache__/
|
|
|
168
171
|
"""
|
|
169
172
|
|
|
170
173
|
|
|
174
|
+
MINIMAL_CANONICAL_STATE = """id: canonical_state
|
|
175
|
+
type: project_state
|
|
176
|
+
version: 0.1
|
|
177
|
+
purpose: small_current_truth_summary_for_ai_navigation
|
|
178
|
+
status: bootstrap_template
|
|
179
|
+
truth_order:
|
|
180
|
+
- current_user_request
|
|
181
|
+
- verified_current_files
|
|
182
|
+
- protocol_rules
|
|
183
|
+
- project_docs
|
|
184
|
+
- conversation_history
|
|
185
|
+
notes:
|
|
186
|
+
- update_this_file_when_project_state_or_decisions_change
|
|
187
|
+
- do_not_treat_this_file_as_truth_without_current_file_verification
|
|
188
|
+
"""
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
MINIMAL_CONTEXT_MAP = """id: project_context_map
|
|
192
|
+
type: context_map
|
|
193
|
+
version: 0.1
|
|
194
|
+
purpose: small_index_for_progressive_context_retrieval
|
|
195
|
+
maintenance:
|
|
196
|
+
current_mode: manual_bootstrap
|
|
197
|
+
rule: aliases_are_pointers_not_truth
|
|
198
|
+
read_first:
|
|
199
|
+
- canonical-state.yaml
|
|
200
|
+
- protocol/fast-path.yaml
|
|
201
|
+
- protocol/router.yaml
|
|
202
|
+
- protocol/route-packs.yaml
|
|
203
|
+
domains: {}
|
|
204
|
+
retrieval_policy:
|
|
205
|
+
order:
|
|
206
|
+
- match_domain_by_alias
|
|
207
|
+
- read_domain_docs_only_when_needed
|
|
208
|
+
- search_candidate_files_or_symbols
|
|
209
|
+
- read_relevant_snippet_first
|
|
210
|
+
- read_full_file_when_snippet_is_not_enough
|
|
211
|
+
"""
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
MINIMAL_DECISIONS_README = """# Decisions
|
|
215
|
+
|
|
216
|
+
Use esta pasta para registrar decisoes estaveis que a IA deve considerar ao
|
|
217
|
+
mapear contexto.
|
|
218
|
+
|
|
219
|
+
Cada decisao deve indicar status, escopo, impacto e arquivo relacionado quando
|
|
220
|
+
existir.
|
|
221
|
+
"""
|
|
222
|
+
|
|
223
|
+
|
|
171
224
|
def main() -> int:
|
|
172
225
|
if DIST.exists():
|
|
173
226
|
shutil.rmtree(DIST)
|
|
@@ -179,6 +232,10 @@ def main() -> int:
|
|
|
179
232
|
(DIST / "AGENTS.md").write_text(MINIMAL_AGENTS, encoding="utf-8")
|
|
180
233
|
(DIST / "README.md").write_text(MINIMAL_README, encoding="utf-8")
|
|
181
234
|
(DIST / ".aiignore").write_text(MINIMAL_AIIGNORE, encoding="utf-8")
|
|
235
|
+
(DIST / "canonical-state.yaml").write_text(MINIMAL_CANONICAL_STATE, encoding="utf-8")
|
|
236
|
+
(DIST / "context-map.yaml").write_text(MINIMAL_CONTEXT_MAP, encoding="utf-8")
|
|
237
|
+
(DIST / "decisions").mkdir(parents=True, exist_ok=True)
|
|
238
|
+
(DIST / "decisions" / "README.md").write_text(MINIMAL_DECISIONS_README, encoding="utf-8")
|
|
182
239
|
for name in PROTOCOL_FILES:
|
|
183
240
|
shutil.copy2(ROOT / "protocol" / name, DIST / "protocol" / name)
|
|
184
241
|
shutil.copy2(ROOT / "protocol" / name, PYTHON_PACKAGE_PROTOCOL / name)
|
|
@@ -10,6 +10,7 @@ const protocolFiles = [
|
|
|
10
10
|
"README.yaml",
|
|
11
11
|
"fast-path.yaml",
|
|
12
12
|
"router.yaml",
|
|
13
|
+
"route-packs.yaml",
|
|
13
14
|
"modes.yaml",
|
|
14
15
|
"execution-rules.yaml",
|
|
15
16
|
"risk-levels.yaml",
|
|
@@ -30,6 +31,50 @@ const aiignoreLines = [
|
|
|
30
31
|
"scripts/__pycache__/",
|
|
31
32
|
"*.pyc",
|
|
32
33
|
];
|
|
34
|
+
const minimalCanonicalState = `id: canonical_state
|
|
35
|
+
type: project_state
|
|
36
|
+
version: 0.1
|
|
37
|
+
purpose: small_current_truth_summary_for_ai_navigation
|
|
38
|
+
status: bootstrap_template
|
|
39
|
+
truth_order:
|
|
40
|
+
- current_user_request
|
|
41
|
+
- verified_current_files
|
|
42
|
+
- protocol_rules
|
|
43
|
+
- project_docs
|
|
44
|
+
- conversation_history
|
|
45
|
+
notes:
|
|
46
|
+
- update_this_file_when_project_state_or_decisions_change
|
|
47
|
+
- do_not_treat_this_file_as_truth_without_current_file_verification
|
|
48
|
+
`;
|
|
49
|
+
const minimalContextMap = `id: project_context_map
|
|
50
|
+
type: context_map
|
|
51
|
+
version: 0.1
|
|
52
|
+
purpose: small_index_for_progressive_context_retrieval
|
|
53
|
+
maintenance:
|
|
54
|
+
current_mode: manual_bootstrap
|
|
55
|
+
rule: aliases_are_pointers_not_truth
|
|
56
|
+
read_first:
|
|
57
|
+
- canonical-state.yaml
|
|
58
|
+
- protocol/fast-path.yaml
|
|
59
|
+
- protocol/router.yaml
|
|
60
|
+
- protocol/route-packs.yaml
|
|
61
|
+
domains: {}
|
|
62
|
+
retrieval_policy:
|
|
63
|
+
order:
|
|
64
|
+
- match_domain_by_alias
|
|
65
|
+
- read_domain_docs_only_when_needed
|
|
66
|
+
- search_candidate_files_or_symbols
|
|
67
|
+
- read_relevant_snippet_first
|
|
68
|
+
- read_full_file_when_snippet_is_not_enough
|
|
69
|
+
`;
|
|
70
|
+
const minimalDecisionsReadme = `# Decisions
|
|
71
|
+
|
|
72
|
+
Use esta pasta para registrar decisoes estaveis que a IA deve considerar ao
|
|
73
|
+
mapear contexto.
|
|
74
|
+
|
|
75
|
+
Cada decisao deve indicar status, escopo, impacto e arquivo relacionado quando
|
|
76
|
+
existir.
|
|
77
|
+
`;
|
|
33
78
|
const requiredText = {
|
|
34
79
|
"AGENTS.md": [
|
|
35
80
|
"AI_PROTOCOL_BEGIN",
|
|
@@ -39,7 +84,14 @@ const requiredText = {
|
|
|
39
84
|
"Nenhum arquivo deve passar de 400 linhas.",
|
|
40
85
|
],
|
|
41
86
|
".aiignore": ["results/", "dist/", "*.pyc"],
|
|
87
|
+
"canonical-state.yaml": ["canonical_state", "truth_order"],
|
|
88
|
+
"context-map.yaml": ["project_context_map", "aliases_are_pointers_not_truth"],
|
|
42
89
|
"protocol/router.yaml": ["feature_or_spec", "spec-driven.yaml", "prompt_improvement"],
|
|
90
|
+
"protocol/route-packs.yaml": [
|
|
91
|
+
"read_pack_first_expand_only_when_needed",
|
|
92
|
+
"simple_answer",
|
|
93
|
+
"context_optimization",
|
|
94
|
+
],
|
|
43
95
|
"protocol/spec-driven.yaml": ["protocol_is_base_spec_is_tool", "do_not_create_spec_for_low_value_tasks"],
|
|
44
96
|
};
|
|
45
97
|
|
|
@@ -78,13 +130,15 @@ editar, classifique risco, escolha rota e valide a entrega.
|
|
|
78
130
|
|
|
79
131
|
1. \`protocol/fast-path.yaml\`
|
|
80
132
|
2. \`protocol/router.yaml\`
|
|
81
|
-
3.
|
|
133
|
+
3. \`protocol/route-packs.yaml\` para ler o resumo compacto da rota.
|
|
134
|
+
4. Arquivo YAML especifico em \`protocol/\` somente quando o pack nao bastar.
|
|
82
135
|
|
|
83
136
|
## Regras de execucao
|
|
84
137
|
|
|
85
138
|
- Classifique o risco antes de agir.
|
|
86
139
|
- Use o menor contexto suficiente.
|
|
87
140
|
- Leia apenas os arquivos indicados por \`protocol/router.yaml\`.
|
|
141
|
+
- Use \`protocol/route-packs.yaml\` antes de abrir todos os arquivos da rota.
|
|
88
142
|
- Quando houver contexto grande, historico longo ou risco de confusao, use
|
|
89
143
|
\`protocol/context-compiler.yaml\` antes de abrir muitos arquivos.
|
|
90
144
|
- Use \`protocol/spec-driven.yaml\` para feature, refatoracao grande ou tarefa
|
|
@@ -194,6 +248,17 @@ function installAiignore(target) {
|
|
|
194
248
|
writeText(target, existing.join("\n").trim() + "\n");
|
|
195
249
|
}
|
|
196
250
|
|
|
251
|
+
function writeIfMissing(file, text) {
|
|
252
|
+
if (fs.existsSync(file)) return;
|
|
253
|
+
writeText(file, text);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function installContextTemplates(targetRoot) {
|
|
257
|
+
writeIfMissing(path.join(targetRoot, "canonical-state.yaml"), minimalCanonicalState);
|
|
258
|
+
writeIfMissing(path.join(targetRoot, "context-map.yaml"), minimalContextMap);
|
|
259
|
+
writeIfMissing(path.join(targetRoot, "decisions", "README.md"), minimalDecisionsReadme);
|
|
260
|
+
}
|
|
261
|
+
|
|
197
262
|
function copyProtocol(target, force, backupRoot) {
|
|
198
263
|
if (fs.existsSync(target) && !force) return;
|
|
199
264
|
if (fs.existsSync(target)) {
|
|
@@ -219,6 +284,7 @@ function install(target, force, dryRun) {
|
|
|
219
284
|
backup(path.join(targetRoot, ".aiignore"), backupRoot);
|
|
220
285
|
installAgents(path.join(targetRoot, "AGENTS.md"));
|
|
221
286
|
installAiignore(path.join(targetRoot, ".aiignore"));
|
|
287
|
+
installContextTemplates(targetRoot);
|
|
222
288
|
copyProtocol(path.join(targetRoot, "protocol"), force, backupRoot);
|
|
223
289
|
console.log(`installed protocol -> ${targetRoot}`);
|
|
224
290
|
return verify(targetRoot);
|
|
@@ -227,7 +293,14 @@ function install(target, force, dryRun) {
|
|
|
227
293
|
function verify(target) {
|
|
228
294
|
const targetRoot = path.resolve(target);
|
|
229
295
|
const errors = [];
|
|
230
|
-
const requiredFiles = [
|
|
296
|
+
const requiredFiles = [
|
|
297
|
+
"AGENTS.md",
|
|
298
|
+
".aiignore",
|
|
299
|
+
"canonical-state.yaml",
|
|
300
|
+
"context-map.yaml",
|
|
301
|
+
"decisions/README.md",
|
|
302
|
+
...protocolFiles.map((file) => `protocol/${file}`),
|
|
303
|
+
];
|
|
231
304
|
for (const item of requiredFiles) {
|
|
232
305
|
const file = path.join(targetRoot, item);
|
|
233
306
|
if (!fs.existsSync(file)) {
|
|
@@ -10,9 +10,13 @@ from pathlib import Path
|
|
|
10
10
|
REQUIRED_FILES = [
|
|
11
11
|
"AGENTS.md",
|
|
12
12
|
".aiignore",
|
|
13
|
+
"canonical-state.yaml",
|
|
14
|
+
"context-map.yaml",
|
|
15
|
+
"decisions/README.md",
|
|
13
16
|
"protocol/README.yaml",
|
|
14
17
|
"protocol/fast-path.yaml",
|
|
15
18
|
"protocol/router.yaml",
|
|
19
|
+
"protocol/route-packs.yaml",
|
|
16
20
|
"protocol/modes.yaml",
|
|
17
21
|
"protocol/execution-rules.yaml",
|
|
18
22
|
"protocol/risk-levels.yaml",
|
|
@@ -42,11 +46,24 @@ REQUIRED_TEXT = {
|
|
|
42
46
|
"dist/",
|
|
43
47
|
"*.pyc",
|
|
44
48
|
],
|
|
49
|
+
"canonical-state.yaml": [
|
|
50
|
+
"canonical_state",
|
|
51
|
+
"truth_order",
|
|
52
|
+
],
|
|
53
|
+
"context-map.yaml": [
|
|
54
|
+
"project_context_map",
|
|
55
|
+
"aliases_are_pointers_not_truth",
|
|
56
|
+
],
|
|
45
57
|
"protocol/router.yaml": [
|
|
46
58
|
"feature_or_spec",
|
|
47
59
|
"spec-driven.yaml",
|
|
48
60
|
"prompt_improvement",
|
|
49
61
|
],
|
|
62
|
+
"protocol/route-packs.yaml": [
|
|
63
|
+
"read_pack_first_expand_only_when_needed",
|
|
64
|
+
"simple_answer",
|
|
65
|
+
"context_optimization",
|
|
66
|
+
],
|
|
50
67
|
"protocol/spec-driven.yaml": [
|
|
51
68
|
"protocol_is_base_spec_is_tool",
|
|
52
69
|
"do_not_create_spec_for_low_value_tasks",
|