ai-execution-protocol 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/AGENTS.md +14 -1
  2. package/README.md +32 -22
  3. package/dist/minimal/.aiignore +8 -8
  4. package/dist/minimal/AGENTS.md +41 -61
  5. package/dist/minimal/candidate-memory/README.md +4 -0
  6. package/dist/minimal/canonical-state.yaml +16 -0
  7. package/dist/minimal/context-map.yaml +22 -0
  8. package/dist/minimal/decisions/README.md +4 -0
  9. package/dist/minimal/memory/INDEX.yaml +20 -0
  10. package/dist/minimal/protocol/README.yaml +9 -1
  11. package/dist/minimal/protocol/adaptive-memory.yaml +97 -0
  12. package/dist/minimal/protocol/context-budget.yaml +44 -0
  13. package/dist/minimal/protocol/context-compiler.yaml +24 -1
  14. package/dist/minimal/protocol/context-rules.yaml +13 -0
  15. package/dist/minimal/protocol/fast-path.yaml +7 -1
  16. package/dist/minimal/protocol/formatting-rules.yaml +27 -0
  17. package/dist/minimal/protocol/persistent-context.yaml +40 -4
  18. package/dist/minimal/protocol/prompt-economy.yaml +16 -8
  19. package/dist/minimal/protocol/route-packs.yaml +184 -0
  20. package/dist/minimal/protocol/router.yaml +25 -1
  21. package/dist/minimal/protocol/selective-validation.yaml +44 -0
  22. package/dist/minimal/protocol/validation-checklist.yaml +10 -1
  23. package/install-manifest.json +64 -0
  24. package/package.json +3 -1
  25. package/protocol/README.yaml +9 -1
  26. package/protocol/adaptive-memory.yaml +97 -0
  27. package/protocol/context-budget.yaml +44 -0
  28. package/protocol/context-compiler.yaml +24 -1
  29. package/protocol/context-rules.yaml +13 -0
  30. package/protocol/fast-path.yaml +7 -1
  31. package/protocol/formatting-rules.yaml +27 -0
  32. package/protocol/persistent-context.yaml +40 -4
  33. package/protocol/prompt-economy.yaml +16 -8
  34. package/protocol/route-packs.yaml +184 -0
  35. package/protocol/router.yaml +25 -1
  36. package/protocol/selective-validation.yaml +44 -0
  37. package/protocol/validation-checklist.yaml +10 -1
  38. package/scripts/README.md +43 -0
  39. package/scripts/build_dist.py +12 -94
  40. package/scripts/npm_install_protocol.js +22 -100
  41. package/scripts/verify_install.py +23 -62
  42. package/templates/minimal/.aiignore +8 -0
  43. package/templates/minimal/AGENTS.md +41 -0
  44. package/templates/minimal/candidate-memory/README.md +4 -0
  45. package/templates/minimal/canonical-state.yaml +16 -0
  46. package/templates/minimal/context-map.yaml +22 -0
  47. package/templates/minimal/decisions/README.md +4 -0
  48. package/templates/minimal/memory/INDEX.yaml +20 -0
@@ -0,0 +1,44 @@
1
+ id: context_budget
2
+ type: operational_rules
3
+ version: 0.3
4
+ purpose: limit_context_cost_without_trading_correctness_or_safety
5
+ principle: budget_guides_reading_risk_can_justify_expansion
6
+ levels:
7
+ level_0:
8
+ initial_tokens_est: 300
9
+ max_files_before_justification: 2
10
+ level_1:
11
+ initial_tokens_est: 1000
12
+ max_files_before_justification: 5
13
+ level_2:
14
+ initial_tokens_est: 4000
15
+ max_files_before_justification: 12
16
+ level_3:
17
+ initial_tokens_est: 6000
18
+ mode: adaptive
19
+ max_files_before_justification: 20
20
+ count:
21
+ - protocol_rules
22
+ - memory_entries
23
+ - project_docs
24
+ - code_snippets
25
+ exclude:
26
+ - generated_reports_not_read
27
+ - files_only_listed_not_opened
28
+ expansion_requires:
29
+ - unresolved_risk
30
+ - missing_dependency
31
+ - unclear_scope
32
+ - insufficient_snippet
33
+ - validation_gap
34
+ stop_when:
35
+ - objective_is_clear
36
+ - target_is_identified
37
+ - risk_is_classified
38
+ - validation_plan_is_clear
39
+ - no_unresolved_gap_requires_more_context
40
+ delivery:
41
+ report_when_exceeded:
42
+ - initial_budget
43
+ - estimated_context_used
44
+ - expansion_reason
@@ -1,6 +1,6 @@
1
1
  id: context_compiler
2
2
  type: operational_rules
3
- version: 0.1
3
+ version: 0.3
4
4
  purpose: build_minimum_context_package_before_model_reasoning
5
5
  principle: conversation_is_interface_not_source_of_truth
6
6
  canonical_state:
@@ -28,19 +28,25 @@ context_build:
28
28
  - user_request
29
29
  - route_from_router
30
30
  - risk_level
31
+ - context_budget
31
32
  - candidate_files_or_areas
33
+ - matching_memory_subjects
32
34
  - recent_validated_state
33
35
  output:
34
36
  - objective
35
37
  - constraints
36
38
  - relevant_rules
39
+ - matching_memory
37
40
  - candidate_files
41
+ - estimated_tokens
42
+ - budget_status
38
43
  - validation_plan
39
44
  - excluded_context
40
45
  selection_policy:
41
46
  include:
42
47
  - context_map_domain_when_available
43
48
  - active_decisions_for_matched_domain
49
+ - active_memory_matching_subject_and_scope
44
50
  - files_required_by_route
45
51
  - snippets_matching_task_terms
46
52
  - current_decisions_touching_candidate_area
@@ -51,6 +57,7 @@ selection_policy:
51
57
  - full_logs_without_error_focus
52
58
  - revoked_decisions_unless_comparing_history
53
59
  - entire_large_files_when_snippet_is_enough
60
+ - candidate_or_archived_memory_without_task_match
54
61
  memory_layers:
55
62
  active:
56
63
  definition: required_to_complete_current_task
@@ -93,6 +100,21 @@ decision_rules:
93
100
  avoid:
94
101
  - treating_alias_as_source_of_truth
95
102
  - editing_from_snippet_when_behavior_depends_on_unread_context
103
+ - id: CTX_006
104
+ when: persistent_memory_may_be_relevant
105
+ do:
106
+ - read_memory_index_first
107
+ - retrieve_only_matching_active_entries
108
+ - verify_project_state_against_current_files
109
+ avoid:
110
+ - loading_all_memory
111
+ - treating_candidate_memory_as_authoritative
112
+ - id: CTX_007
113
+ when: initial_context_budget_is_reached
114
+ do:
115
+ - stop_if_objective_target_and_validation_are_clear
116
+ - expand_only_for_unresolved_risk_dependency_scope_or_validation_gap
117
+ - record_expansion_reason
96
118
  retrieval_tiers:
97
119
  mvp:
98
120
  use:
@@ -121,6 +143,7 @@ delivery:
121
143
  include_when_relevant:
122
144
  - context_used
123
145
  - context_excluded
146
+ - context_budget_status
124
147
  - reason_for_not_reading_more
125
148
  economy_goal:
126
149
  target: reduce_unneeded_context_up_to_90_percent_when_safe
@@ -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
@@ -1,9 +1,11 @@
1
1
  id: fast_path
2
2
  type: agent_entrypoint
3
- version: 0.1
3
+ version: 0.3
4
4
  purpose: minimum_rules_to_start_any_task
5
5
  read_next:
6
6
  - router.yaml
7
+ - route-packs.yaml
8
+ - context-budget.yaml
7
9
  - modes.yaml
8
10
  core_rules:
9
11
  - classify_risk_before_action
@@ -19,6 +21,9 @@ core_rules:
19
21
  - include_test_list_when_break_risk_exists
20
22
  - explain_in_plain_language_for_non_experts
21
23
  - use_context_compiler_when_context_or_history_is_large
24
+ - use_only_matching_memory_subjects
25
+ - check_memory_update_result_after_task
26
+ - use_selective_validation_by_blast_radius
22
27
  risk_short:
23
28
  level_0: answer_only
24
29
  level_1: small_clear_reversible_isolated_change
@@ -31,3 +36,4 @@ file_policy:
31
36
  stop_reading_when:
32
37
  - enough_context_to_act_safely
33
38
  - validation_plan_is_clear
39
+ - context_budget_is_sufficient
@@ -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
@@ -1,6 +1,6 @@
1
1
  id: persistent_context
2
2
  type: operational_rules
3
- version: 0.2
3
+ version: 0.3
4
4
  purpose: navigate_project_memory_without_loading_unneeded_context
5
5
  principle: aliases_are_pointers_not_truth
6
6
  autonomous_memory:
@@ -22,6 +22,7 @@ economy_goal:
22
22
  entrypoints:
23
23
  - canonical-state.yaml
24
24
  - context-map.yaml
25
+ - memory/INDEX.yaml
25
26
  - decisions/
26
27
  progressive_retrieval:
27
28
  order:
@@ -29,7 +30,9 @@ progressive_retrieval:
29
30
  - match_domain_or_alias_in_context_map
30
31
  - read_canonical_state_when_project_truth_matters
31
32
  - read_active_decisions_for_domain
32
- - read_only_needed_domain_docs
33
+ - query_memory_index_for_matching_subjects
34
+ - read_only_matching_active_memory
35
+ - read_only_needed_atomic_subject_docs
33
36
  - search_candidate_symbols_or_files
34
37
  - read_relevant_snippet_first
35
38
  - read_direct_dependencies_when_needed
@@ -51,6 +54,8 @@ context_validator:
51
54
  check:
52
55
  - enough_context_for_objective
53
56
  - active_decisions_loaded_when_relevant
57
+ - matching_memory_loaded_only_when_relevant
58
+ - context_budget_respected_or_expansion_justified
54
59
  - direct_dependencies_loaded_when_needed
55
60
  - adjacent_domain_risk_checked
56
61
  - docs_do_not_conflict_with_verified_files
@@ -88,9 +93,11 @@ snippet_policy:
88
93
  conflict_policy:
89
94
  order:
90
95
  - current_user_request
91
- - canonical_state
92
- - active_decisions
93
96
  - verified_code_or_files_this_turn
97
+ - active_decisions
98
+ - canonical_state
99
+ - explicit_user_preferences
100
+ - inferred_patterns_with_evidence
94
101
  - domain_docs
95
102
  - current_conversation
96
103
  if_docs_conflict_with_code:
@@ -100,4 +107,33 @@ validation:
100
107
  require:
101
108
  - state_context_used_when_relevant
102
109
  - state_context_not_loaded_when_excluded_for_economy
110
+ - memory_index_used_before_memory_files
111
+ - memory_update_result_recorded_when_new_durable_fact_exists
112
+ - sensitive_or_unverified_content_not_promoted
103
113
  - escalate_context_if_snippet_is_insufficient
114
+ - update_subject_index_when_docs_are_split
115
+ atomic_subject_flow:
116
+ order:
117
+ - identify_subject_terms_from_request
118
+ - find_subject_doc_by_context_map_index_or_rg
119
+ - read_subject_doc_before_broad_doc
120
+ - use_rg_for_exact_code_symbol_or_term
121
+ - read_code_snippet_first
122
+ - expand_to_full_file_or_related_doc_when_needed
123
+ failure_mitigations:
124
+ fragmentation:
125
+ - do_not_create_doc_for_micro_detail_without_standalone_subject
126
+ - merge_or_link_overlapping_docs
127
+ bad_names:
128
+ - include_domain_flow_component_or_symbol_terms_in_filename
129
+ duplicates:
130
+ - search_existing_docs_before_creating_new_doc
131
+ - prefer_updating_existing_subject_doc
132
+ stale_docs:
133
+ - verify_current_code_before_behavior_claim
134
+ - report_stale_doc_risk
135
+ wrong_search_terms:
136
+ - use_aliases_and_synonyms_as_search_terms
137
+ - search_docs_and_code_with_rg
138
+ insufficient_snippet:
139
+ - expand_to_imports_types_callers_or_full_file
@@ -1,6 +1,6 @@
1
1
  id: prompt_economy
2
2
  type: operational_rules
3
- version: 0.1
3
+ version: 0.3
4
4
  purpose: improve_user_prompt_without_token_bloat
5
5
  principle: always_improve_prompt_only_as_much_as_needed_for_safe_execution
6
6
  rules:
@@ -34,15 +34,20 @@ rules:
34
34
  - validation
35
35
  - confirmation_if_needed
36
36
  - id: PROMPT_005
37
- name: always_show_prompt_comparison
37
+ name: show_prompt_comparison_when_interpretation_matters
38
38
  do:
39
- - include_user_original_prompt
40
- - include_ai_improved_prompt
39
+ - include_user_original_prompt_for_technical_or_interpreted_tasks
40
+ - include_ai_improved_prompt_for_technical_or_interpreted_tasks
41
41
  - keep_comparison_to_minimum_viable_words
42
42
  - preserve_user_language_when_possible
43
43
  avoid:
44
44
  - hiding_interpretation_from_user
45
45
  - expanding_simple_requests_into_large_specs
46
+ may_omit_when:
47
+ - level_0
48
+ - no_technical_action
49
+ - no_scope_or_intent_interpretation
50
+ - direct_answer_is_clearer
46
51
  limits:
47
52
  level_0:
48
53
  max_lines: 5
@@ -75,16 +80,19 @@ delivery_rule:
75
80
  - "Feito: <what changed or answer>"
76
81
  - "Validado: <evidence or not run>"
77
82
  - "Risco: <residual risk or none>"
78
- always_show:
79
- - prompt_original
80
- - prompt_melhorado_da_ia
83
+ show_when:
84
+ - technical_action
85
+ - scope_interpretation
86
+ - risk_level_1_or_higher
87
+ - prompt_improvement_changes_execution
81
88
  comparison:
82
89
  - original_prompt_must_keep_user_words_when_reasonable
83
90
  - improved_prompt_must_state_objective_scope_risk_validation
84
91
  - improved_prompt_must_fit_risk_level_limits
85
92
  token_policy:
86
93
  - use_abbreviated_labels_po_pm_when_user_did_not_request_full_form
87
- - level_0_and_1_use_micro_template
94
+ - level_0_may_use_direct_answer_when_comparison_adds_no_value
95
+ - level_1_use_micro_template
88
96
  - level_2_use_compact_objective_scope_validation
89
97
  - level_3_include_risk_confirmation_without_long_spec
90
98
  - omit_tests_line_when_no_break_risk_exists
@@ -0,0 +1,184 @@
1
+ id: route_packs
2
+ type: route_summary_index
3
+ version: 0.3
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
154
+ memory_update:
155
+ risk: 1
156
+ read_if_pack_insufficient:
157
+ - adaptive-memory.yaml
158
+ - context-budget.yaml
159
+ - validation-checklist.yaml
160
+ do:
161
+ - extract_only_stable_non_sensitive_knowledge
162
+ - search_before_create
163
+ - merge_replace_or_keep_unchanged
164
+ - update_memory_index
165
+ - report_memory_update_result
166
+ memory_conflict_or_replacement:
167
+ risk: 2
168
+ read_if_pack_insufficient:
169
+ - adaptive-memory.yaml
170
+ - context-compiler.yaml
171
+ - validation-checklist.yaml
172
+ do:
173
+ - preserve_provenance
174
+ - mark_old_entry_replaced
175
+ - keep_current_request_authoritative
176
+ - validate_no_duplicate_active_entry
177
+ selective_validation:
178
+ risk: 1
179
+ read_if_pack_insufficient:
180
+ - selective-validation.yaml
181
+ do:
182
+ - infer_checks_from_changed_files
183
+ - run_smallest_sufficient_validation
184
+ - expand_when_shared_contract_changes
@@ -1,6 +1,6 @@
1
1
  id: protocol_router
2
2
  type: read_router
3
- version: 0.1
3
+ version: 0.3
4
4
  purpose: choose_minimum_protocol_files_by_task
5
5
  default_read:
6
6
  - fast-path.yaml
@@ -93,9 +93,33 @@ routes:
93
93
  - persistent-context.yaml
94
94
  - context-rules.yaml
95
95
  - context-compiler.yaml
96
+ - context-budget.yaml
97
+ memory_update:
98
+ risk: 1
99
+ read:
100
+ - fast-path.yaml
101
+ - adaptive-memory.yaml
102
+ - context-budget.yaml
103
+ - validation-checklist.yaml
104
+ memory_conflict_or_replacement:
105
+ risk: 2
106
+ read:
107
+ - fast-path.yaml
108
+ - adaptive-memory.yaml
109
+ - context-compiler.yaml
110
+ - validation-checklist.yaml
111
+ selective_validation:
112
+ risk: 1
113
+ read:
114
+ - fast-path.yaml
115
+ - selective-validation.yaml
96
116
  rules:
97
117
  - start_with_default_read
98
118
  - choose_one_route_if_task_type_is_clear
119
+ - read_route_pack_before_full_route_files_when_available
120
+ - expand_from_route_pack_only_when_needed
121
+ - apply_context_budget_to_selected_route
122
+ - retrieve_only_matching_memory_subjects
99
123
  - if_route_unclear_read_risk_levels_then_choose_route
100
124
  - do_not_read_docs_unless_protocol_is_insufficient
101
125
  - do_not_read_cases_unless_testing_or_comparing_behavior
@@ -0,0 +1,44 @@
1
+ id: selective_validation
2
+ type: operational_rules
3
+ version: 0.3
4
+ purpose: run_smallest_validation_set_that_proves_the_change
5
+ principle: validation_scales_with_behavior_and_blast_radius
6
+ selection:
7
+ docs_only:
8
+ run:
9
+ - link_check
10
+ - text_search
11
+ - schema_if_structured
12
+ protocol_rule:
13
+ run:
14
+ - schema_validation
15
+ - mirror_sync
16
+ - framework_targeted_tests
17
+ parser_or_evaluator:
18
+ run:
19
+ - parser_adversarial_tests
20
+ - framework_tests
21
+ - benchmark_runner
22
+ installer_or_package:
23
+ run:
24
+ - install_test
25
+ - verify_install
26
+ - package_dry_run
27
+ shared_or_cross_module:
28
+ run:
29
+ - framework_tests
30
+ - health_check
31
+ release:
32
+ run:
33
+ - framework_tests
34
+ - schema_strict
35
+ - health_check
36
+ - npm_dry_run
37
+ - python_build
38
+ - twine_check
39
+ rules:
40
+ - infer_validation_from_changed_files_and_behavior
41
+ - expand_validation_when_shared_contract_changes
42
+ - never_claim_unrun_validation
43
+ - full_health_check_is_not_required_for_every_small_change
44
+ - user_visible_or_critical_change_requires_manual_test_guidance
@@ -1,6 +1,7 @@
1
1
  id: validation_checklist
2
2
  type: checklist
3
- version: 0.1
3
+ version: 0.3
4
+ selection_source: protocol/selective-validation.yaml
4
5
  automatic_validation:
5
6
  - unit_tests
6
7
  - integration_tests
@@ -57,3 +58,11 @@ rules:
57
58
  - make_limits_and_residual_risk_understandable
58
59
  - prefer_one_line_per_delivery_field
59
60
  - use_micro_format_only_when_readable
61
+ - id: VAL_005
62
+ always:
63
+ - select_smallest_validation_set_that_proves_behavior
64
+ - expand_when_shared_contract_or_blast_radius_requires
65
+ - record_every_expected_validation_not_run
66
+ avoid:
67
+ - full_health_check_for_trivial_local_change
68
+ - unrelated_expensive_validation
package/scripts/README.md CHANGED
@@ -47,6 +47,32 @@ Para medir uma rota especifica:
47
47
  python scripts/token_report.py --route user_flow_bug --out results/token-user-flow-bug.yaml
48
48
  ```
49
49
 
50
+ ## context_package.py
51
+
52
+ Gera um pacote de contexto limitado por risco, rota, memoria e candidatos.
53
+
54
+ ```powershell
55
+ python scripts/context_package.py --objective "Revisar memoria" --route memory_update --risk 2 --term memory
56
+ ```
57
+
58
+ ## memory_manager.py
59
+
60
+ Inclui, consulta e valida memoria adaptativa com deduplicacao e bloqueio de
61
+ conteudo sensivel.
62
+
63
+ ```powershell
64
+ python scripts/memory_manager.py --root . validate
65
+ ```
66
+
67
+ ## selective_validation.py
68
+
69
+ Seleciona as verificacoes proporcionais aos arquivos alterados.
70
+
71
+ ```powershell
72
+ python scripts/selective_validation.py
73
+ python scripts/selective_validation.py --release
74
+ ```
75
+
50
76
  ## health_check.py
51
77
 
52
78
  Roda a validacao geral do framework.
@@ -102,6 +128,23 @@ python scripts/framework_tests.py
102
128
 
103
129
  O relatorio fica em `results/framework-test-report.yaml`.
104
130
 
131
+ ## v03_tests.py
132
+
133
+ Testa memoria, orcamento de contexto, validacao seletiva e manifesto de
134
+ instalacao.
135
+
136
+ ```powershell
137
+ python scripts/v03_tests.py
138
+ ```
139
+
140
+ ## context_economy_benchmark.py
141
+
142
+ Compara leitura ampla com rotas focadas da v0.3.0.
143
+
144
+ ```powershell
145
+ python scripts/context_economy_benchmark.py
146
+ ```
147
+
105
148
  ## build_dist.py
106
149
 
107
150
  Gera `dist/minimal/` a partir de `AGENTS.md` minimo e `protocol/`.