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/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.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
|
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
|
|
@@ -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
|
package/protocol/router.yaml
CHANGED
|
@@ -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/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",
|
|
@@ -23,6 +24,7 @@ PROTOCOL_FILES = [
|
|
|
23
24
|
"validation-checklist.yaml",
|
|
24
25
|
"context-rules.yaml",
|
|
25
26
|
"context-compiler.yaml",
|
|
27
|
+
"persistent-context.yaml",
|
|
26
28
|
"formatting-rules.yaml",
|
|
27
29
|
"prompt-economy.yaml",
|
|
28
30
|
"spec-driven.yaml",
|
|
@@ -46,13 +48,15 @@ editar, classifique risco, escolha rota e valide a entrega.
|
|
|
46
48
|
|
|
47
49
|
1. `protocol/fast-path.yaml`
|
|
48
50
|
2. `protocol/router.yaml`
|
|
49
|
-
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.
|
|
50
53
|
|
|
51
54
|
## Regras de execucao
|
|
52
55
|
|
|
53
56
|
- Classifique o risco antes de agir.
|
|
54
57
|
- Use o menor contexto suficiente.
|
|
55
58
|
- Leia apenas os arquivos indicados por `protocol/router.yaml`.
|
|
59
|
+
- Use `protocol/route-packs.yaml` antes de abrir todos os arquivos da rota.
|
|
56
60
|
- Quando houver contexto grande, historico longo ou risco de confusao, use
|
|
57
61
|
`protocol/context-compiler.yaml` antes de abrir muitos arquivos.
|
|
58
62
|
- Use `protocol/spec-driven.yaml` para feature, refatoracao grande ou tarefa
|
|
@@ -167,6 +171,56 @@ scripts/__pycache__/
|
|
|
167
171
|
"""
|
|
168
172
|
|
|
169
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
|
+
|
|
170
224
|
def main() -> int:
|
|
171
225
|
if DIST.exists():
|
|
172
226
|
shutil.rmtree(DIST)
|
|
@@ -178,6 +232,10 @@ def main() -> int:
|
|
|
178
232
|
(DIST / "AGENTS.md").write_text(MINIMAL_AGENTS, encoding="utf-8")
|
|
179
233
|
(DIST / "README.md").write_text(MINIMAL_README, encoding="utf-8")
|
|
180
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")
|
|
181
239
|
for name in PROTOCOL_FILES:
|
|
182
240
|
shutil.copy2(ROOT / "protocol" / name, DIST / "protocol" / name)
|
|
183
241
|
shutil.copy2(ROOT / "protocol" / name, PYTHON_PACKAGE_PROTOCOL / name)
|