ai-execution-protocol 0.2.1 → 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 (44) hide show
  1. package/AGENTS.md +11 -1
  2. package/README.md +29 -6
  3. package/dist/minimal/.aiignore +8 -8
  4. package/dist/minimal/AGENTS.md +41 -63
  5. package/dist/minimal/candidate-memory/README.md +4 -0
  6. package/dist/minimal/canonical-state.yaml +16 -14
  7. package/dist/minimal/context-map.yaml +22 -20
  8. package/dist/minimal/decisions/README.md +4 -7
  9. package/dist/minimal/memory/INDEX.yaml +20 -0
  10. package/dist/minimal/protocol/README.yaml +7 -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/fast-path.yaml +6 -1
  15. package/dist/minimal/protocol/persistent-context.yaml +13 -3
  16. package/dist/minimal/protocol/prompt-economy.yaml +16 -8
  17. package/dist/minimal/protocol/route-packs.yaml +32 -1
  18. package/dist/minimal/protocol/router.yaml +23 -1
  19. package/dist/minimal/protocol/selective-validation.yaml +44 -0
  20. package/dist/minimal/protocol/validation-checklist.yaml +10 -1
  21. package/install-manifest.json +64 -0
  22. package/package.json +3 -1
  23. package/protocol/README.yaml +7 -1
  24. package/protocol/adaptive-memory.yaml +97 -0
  25. package/protocol/context-budget.yaml +44 -0
  26. package/protocol/context-compiler.yaml +24 -1
  27. package/protocol/fast-path.yaml +6 -1
  28. package/protocol/persistent-context.yaml +13 -3
  29. package/protocol/prompt-economy.yaml +16 -8
  30. package/protocol/route-packs.yaml +32 -1
  31. package/protocol/router.yaml +23 -1
  32. package/protocol/selective-validation.yaml +44 -0
  33. package/protocol/validation-checklist.yaml +10 -1
  34. package/scripts/README.md +43 -0
  35. package/scripts/build_dist.py +12 -151
  36. package/scripts/npm_install_protocol.js +10 -161
  37. package/scripts/verify_install.py +23 -79
  38. package/templates/minimal/.aiignore +8 -0
  39. package/templates/minimal/AGENTS.md +41 -0
  40. package/templates/minimal/candidate-memory/README.md +4 -0
  41. package/templates/minimal/canonical-state.yaml +16 -0
  42. package/templates/minimal/context-map.yaml +22 -0
  43. package/templates/minimal/decisions/README.md +4 -0
  44. package/templates/minimal/memory/INDEX.yaml +20 -0
@@ -1,93 +1,34 @@
1
1
  #!/usr/bin/env python3
2
- """Verify that a target project has the mandatory AI protocol installed."""
2
+ """Verify an installed protocol using the shared install manifest."""
3
3
 
4
4
  from __future__ import annotations
5
5
 
6
6
  import argparse
7
+ import json
7
8
  from pathlib import Path
8
9
 
9
10
 
10
- REQUIRED_FILES = [
11
- "AGENTS.md",
12
- ".aiignore",
13
- "canonical-state.yaml",
14
- "context-map.yaml",
15
- "decisions/README.md",
16
- "protocol/README.yaml",
17
- "protocol/fast-path.yaml",
18
- "protocol/router.yaml",
19
- "protocol/route-packs.yaml",
20
- "protocol/modes.yaml",
21
- "protocol/execution-rules.yaml",
22
- "protocol/risk-levels.yaml",
23
- "protocol/mapping-checklists.yaml",
24
- "protocol/validation-checklist.yaml",
25
- "protocol/context-rules.yaml",
26
- "protocol/context-compiler.yaml",
27
- "protocol/persistent-context.yaml",
28
- "protocol/formatting-rules.yaml",
29
- "protocol/prompt-economy.yaml",
30
- "protocol/spec-driven.yaml",
31
- ]
11
+ ROOT = Path(__file__).resolve().parents[1]
32
12
 
33
- REQUIRED_TEXT = {
34
- "AGENTS.md": [
35
- "AI_PROTOCOL_BEGIN",
36
- "protocol/fast-path.yaml",
37
- "protocol/router.yaml",
38
- "Classifique o risco antes de agir",
39
- "Prompt original",
40
- "Prompt melhorado da IA",
41
- "lista do que",
42
- "Nenhum arquivo deve passar de 400 linhas.",
43
- ],
44
- ".aiignore": [
45
- "results/",
46
- "dist/",
47
- "*.pyc",
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
- ],
57
- "protocol/router.yaml": [
58
- "feature_or_spec",
59
- "spec-driven.yaml",
60
- "prompt_improvement",
61
- ],
62
- "protocol/route-packs.yaml": [
63
- "read_pack_first_expand_only_when_needed",
64
- "simple_answer",
65
- "context_optimization",
66
- ],
67
- "protocol/spec-driven.yaml": [
68
- "protocol_is_base_spec_is_tool",
69
- "do_not_create_spec_for_low_value_tasks",
70
- ],
71
- }
72
13
 
14
+ def load_manifest() -> dict:
15
+ return json.loads((ROOT / "install-manifest.json").read_text(encoding="utf-8"))
73
16
 
74
- def main() -> int:
75
- parser = argparse.ArgumentParser()
76
- parser.add_argument("--target", required=True, help="Project root to verify")
77
- args = parser.parse_args()
78
-
79
- root = Path(args.target).resolve()
80
- errors: list[str] = []
81
17
 
82
- for item in REQUIRED_FILES:
18
+ def verify(root: Path) -> list[str]:
19
+ manifest = load_manifest()
20
+ required = manifest["required_files"] + [
21
+ f"protocol/{name}" for name in manifest["protocol_files"]
22
+ ]
23
+ errors = []
24
+ for item in required:
83
25
  path = root / item
84
26
  if not path.exists():
85
27
  errors.append(f"missing:{item}")
86
28
  continue
87
29
  if path.is_file() and len(path.read_text(encoding="utf-8").splitlines()) > 400:
88
30
  errors.append(f"line_limit:{item}")
89
-
90
- for item, snippets in REQUIRED_TEXT.items():
31
+ for item, snippets in manifest["required_text"].items():
91
32
  path = root / item
92
33
  if not path.exists() or not path.is_file():
93
34
  continue
@@ -95,15 +36,18 @@ def main() -> int:
95
36
  for snippet in snippets:
96
37
  if snippet not in text:
97
38
  errors.append(f"missing_text:{item}:{snippet}")
39
+ return errors
98
40
 
99
- if errors:
100
- print("FAIL")
101
- for error in errors:
102
- print(error)
103
- return 1
104
41
 
105
- print("PASS")
106
- return 0
42
+ def main() -> int:
43
+ parser = argparse.ArgumentParser()
44
+ parser.add_argument("--target", required=True, help="Project root to verify")
45
+ args = parser.parse_args()
46
+ errors = verify(Path(args.target).resolve())
47
+ print("PASS" if not errors else "FAIL")
48
+ for error in errors:
49
+ print(error)
50
+ return 1 if errors else 0
107
51
 
108
52
 
109
53
  if __name__ == "__main__":
@@ -0,0 +1,8 @@
1
+ results/
2
+ benchmarks/generated/
3
+ model-runs/generated/
4
+ dist/
5
+ memory/archive/
6
+ candidate-memory/
7
+ scripts/__pycache__/
8
+ *.pyc
@@ -0,0 +1,41 @@
1
+ # AGENTS.md
2
+
3
+ ## Regra principal
4
+
5
+ <!-- AI_PROTOCOL_BEGIN -->
6
+
7
+ Use `protocol/fast-path.yaml` como entrada operacional minima.
8
+
9
+ Este protocolo e obrigatorio para tarefas tecnicas. Classifique risco, escolha
10
+ rota, consulte o pack compacto, carregue somente memoria relevante e valide a
11
+ entrega.
12
+
13
+ ## Ordem de leitura
14
+
15
+ 1. `protocol/fast-path.yaml`
16
+ 2. `protocol/router.yaml`
17
+ 3. `protocol/route-packs.yaml`
18
+ 4. `memory/INDEX.yaml` somente quando memoria puder ajudar
19
+ 5. YAML completo da rota somente quando o pack nao bastar
20
+
21
+ ## Regras de execucao
22
+
23
+ - Classifique o risco antes de agir.
24
+ - Use o menor contexto suficiente e respeite `protocol/context-budget.yaml`.
25
+ - Memoria orienta; pedido atual autoriza; codigo verificado define realidade.
26
+ - Nunca amplie escopo com base em previsao ou preferencia antiga.
27
+ - Use `protocol/selective-validation.yaml` para escolher a menor prova suficiente.
28
+ - Ao terminar, verifique memoria: updated, unchanged, candidate, replaced ou
29
+ blocked_sensitive.
30
+ - Nao persista segredo, token, dado de cliente ou informacao pessoal desnecessaria.
31
+ - Para nivel critico, peca confirmacao antes de acao sensivel.
32
+ - Entregue mudanca, validacao, limite e risco residual em poucas linhas.
33
+
34
+ ## Regras de organizacao
35
+
36
+ - Nenhum arquivo fonte deve passar de 400 linhas.
37
+ - Organize por assunto rastreavel.
38
+ - Use YAML para operacao e Markdown para explicacao.
39
+ - Evite duplicar regras e memoria.
40
+
41
+ <!-- AI_PROTOCOL_END -->
@@ -0,0 +1,4 @@
1
+ # Candidate Memory
2
+
3
+ Store inferred, non-sensitive memory candidates here until evidence or user
4
+ confirmation is enough for promotion.
@@ -0,0 +1,16 @@
1
+ id: canonical_state
2
+ type: project_state
3
+ version: 0.3
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
+ - active_project_decisions
10
+ - explicit_user_preferences
11
+ - inferred_patterns_with_evidence
12
+ - project_docs
13
+ - conversation_history
14
+ notes:
15
+ - memory_guides_current_request_authorizes
16
+ - update_when_verified_project_state_changes
@@ -0,0 +1,22 @@
1
+ id: project_context_map
2
+ type: context_map
3
+ version: 0.3
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
+ - memory/INDEX.yaml
14
+ domains: {}
15
+ retrieval_policy:
16
+ order:
17
+ - match_domain_by_alias
18
+ - read_matching_memory_subjects
19
+ - read_domain_docs_only_when_needed
20
+ - search_candidate_files_or_symbols
21
+ - read_relevant_snippet_first
22
+ - read_full_file_when_snippet_is_not_enough
@@ -0,0 +1,4 @@
1
+ # Decisions
2
+
3
+ Record confirmed project decisions with status, scope, evidence and replacement
4
+ history.
@@ -0,0 +1,20 @@
1
+ id: memory_index
2
+ type: memory_index
3
+ version: 0.3
4
+ purpose: route_to_minimum_relevant_persistent_memory
5
+ policy:
6
+ - read_only_matching_subjects
7
+ - do_not_load_archive_by_default
8
+ - current_request_overrides_memory
9
+ - verified_files_override_stale_memory
10
+ entries: []
11
+ areas:
12
+ user:
13
+ path: memory/user/
14
+ projects:
15
+ path: memory/projects/
16
+ patterns:
17
+ path: memory/patterns/
18
+ archive:
19
+ path: memory/archive/
20
+ read_by_default: false