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.
- package/AGENTS.md +14 -1
- package/README.md +32 -22
- package/dist/minimal/.aiignore +8 -8
- package/dist/minimal/AGENTS.md +41 -61
- package/dist/minimal/candidate-memory/README.md +4 -0
- package/dist/minimal/canonical-state.yaml +16 -0
- package/dist/minimal/context-map.yaml +22 -0
- package/dist/minimal/decisions/README.md +4 -0
- package/dist/minimal/memory/INDEX.yaml +20 -0
- package/dist/minimal/protocol/README.yaml +9 -1
- package/dist/minimal/protocol/adaptive-memory.yaml +97 -0
- package/dist/minimal/protocol/context-budget.yaml +44 -0
- package/dist/minimal/protocol/context-compiler.yaml +24 -1
- package/dist/minimal/protocol/context-rules.yaml +13 -0
- package/dist/minimal/protocol/fast-path.yaml +7 -1
- package/dist/minimal/protocol/formatting-rules.yaml +27 -0
- package/dist/minimal/protocol/persistent-context.yaml +40 -4
- package/dist/minimal/protocol/prompt-economy.yaml +16 -8
- package/dist/minimal/protocol/route-packs.yaml +184 -0
- package/dist/minimal/protocol/router.yaml +25 -1
- package/dist/minimal/protocol/selective-validation.yaml +44 -0
- package/dist/minimal/protocol/validation-checklist.yaml +10 -1
- package/install-manifest.json +64 -0
- package/package.json +3 -1
- package/protocol/README.yaml +9 -1
- package/protocol/adaptive-memory.yaml +97 -0
- package/protocol/context-budget.yaml +44 -0
- package/protocol/context-compiler.yaml +24 -1
- package/protocol/context-rules.yaml +13 -0
- package/protocol/fast-path.yaml +7 -1
- package/protocol/formatting-rules.yaml +27 -0
- package/protocol/persistent-context.yaml +40 -4
- package/protocol/prompt-economy.yaml +16 -8
- package/protocol/route-packs.yaml +184 -0
- package/protocol/router.yaml +25 -1
- package/protocol/selective-validation.yaml +44 -0
- package/protocol/validation-checklist.yaml +10 -1
- package/scripts/README.md +43 -0
- package/scripts/build_dist.py +12 -94
- package/scripts/npm_install_protocol.js +22 -100
- package/scripts/verify_install.py +23 -62
- package/templates/minimal/.aiignore +8 -0
- package/templates/minimal/AGENTS.md +41 -0
- package/templates/minimal/candidate-memory/README.md +4 -0
- package/templates/minimal/canonical-state.yaml +16 -0
- package/templates/minimal/context-map.yaml +22 -0
- package/templates/minimal/decisions/README.md +4 -0
- package/templates/minimal/memory/INDEX.yaml +20 -0
package/scripts/build_dist.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
+
import json
|
|
6
7
|
import shutil
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
|
|
@@ -10,88 +11,7 @@ from pathlib import Path
|
|
|
10
11
|
ROOT = Path(__file__).resolve().parents[1]
|
|
11
12
|
DIST = ROOT / "dist" / "minimal"
|
|
12
13
|
PYTHON_PACKAGE_PROTOCOL = ROOT / "ai_execution_protocol" / "protocol"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
PROTOCOL_FILES = [
|
|
16
|
-
"README.yaml",
|
|
17
|
-
"fast-path.yaml",
|
|
18
|
-
"router.yaml",
|
|
19
|
-
"modes.yaml",
|
|
20
|
-
"execution-rules.yaml",
|
|
21
|
-
"risk-levels.yaml",
|
|
22
|
-
"mapping-checklists.yaml",
|
|
23
|
-
"validation-checklist.yaml",
|
|
24
|
-
"context-rules.yaml",
|
|
25
|
-
"context-compiler.yaml",
|
|
26
|
-
"persistent-context.yaml",
|
|
27
|
-
"formatting-rules.yaml",
|
|
28
|
-
"prompt-economy.yaml",
|
|
29
|
-
"spec-driven.yaml",
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
MINIMAL_AGENTS = """# AGENTS.md
|
|
34
|
-
|
|
35
|
-
## Regra principal
|
|
36
|
-
|
|
37
|
-
<!-- AI_PROTOCOL_BEGIN -->
|
|
38
|
-
|
|
39
|
-
Use `protocol/fast-path.yaml` como entrada operacional minima.
|
|
40
|
-
|
|
41
|
-
Siga `.aiignore` antes de abrir relatorios gerados.
|
|
42
|
-
|
|
43
|
-
Este protocolo e obrigatorio para tarefas tecnicas neste projeto. Antes de
|
|
44
|
-
editar, classifique risco, escolha rota e valide a entrega.
|
|
45
|
-
|
|
46
|
-
## Ordem de leitura
|
|
47
|
-
|
|
48
|
-
1. `protocol/fast-path.yaml`
|
|
49
|
-
2. `protocol/router.yaml`
|
|
50
|
-
3. Arquivo YAML especifico em `protocol/` conforme a rota.
|
|
51
|
-
|
|
52
|
-
## Regras de execucao
|
|
53
|
-
|
|
54
|
-
- Classifique o risco antes de agir.
|
|
55
|
-
- Use o menor contexto suficiente.
|
|
56
|
-
- Leia apenas os arquivos indicados por `protocol/router.yaml`.
|
|
57
|
-
- Quando houver contexto grande, historico longo ou risco de confusao, use
|
|
58
|
-
`protocol/context-compiler.yaml` antes de abrir muitos arquivos.
|
|
59
|
-
- Use `protocol/spec-driven.yaml` para feature, refatoracao grande ou tarefa
|
|
60
|
-
critica, sem criar spec pesada para tarefa simples.
|
|
61
|
-
- Sempre entregue `Prompt original` e `Prompt melhorado da IA`; em baixo risco,
|
|
62
|
-
prefira micro formato legivel com `PO`, `PM` e `OK`.
|
|
63
|
-
- Nao edite arquivo que nao foi identificado como candidato.
|
|
64
|
-
- Preserve documentos, regras de IDE e configuracoes de framework existentes,
|
|
65
|
-
salvo pedido explicito do usuario.
|
|
66
|
-
- Se o risco subir, atualize a classificacao antes de continuar.
|
|
67
|
-
- Para nivel critico, peca confirmacao antes de acao sensivel.
|
|
68
|
-
- Quando houver risco de quebrar fluxo existente, entregue uma lista do que
|
|
69
|
-
testar.
|
|
70
|
-
- Entregue com evidencia em poucas linhas: mudanca, validacao, limite e risco
|
|
71
|
-
residual.
|
|
72
|
-
- Explique o resultado em linguagem clara para uma pessoa leiga entender.
|
|
73
|
-
|
|
74
|
-
## Convivencia com arquivos existentes
|
|
75
|
-
|
|
76
|
-
Quando houver conflito, siga esta prioridade:
|
|
77
|
-
|
|
78
|
-
1. pedido atual do usuario;
|
|
79
|
-
2. este bloco obrigatorio em `AGENTS.md`;
|
|
80
|
-
3. regras especificas da IDE ou do projeto;
|
|
81
|
-
4. docs e historico somente quando a rota pedir.
|
|
82
|
-
|
|
83
|
-
Nao sobrescreva `README.md`, `docs/`, `.cursorrules`, `CLAUDE.md`,
|
|
84
|
-
`.github/copilot-instructions.md` ou configs de framework sem pedido claro.
|
|
85
|
-
|
|
86
|
-
## Regras de organizacao
|
|
87
|
-
|
|
88
|
-
- Nenhum arquivo deve passar de 400 linhas.
|
|
89
|
-
- Organize primeiro para legibilidade por IA.
|
|
90
|
-
- Use YAML para regras operacionais.
|
|
91
|
-
- Evite duplicar a mesma regra em muitos lugares.
|
|
92
|
-
|
|
93
|
-
<!-- AI_PROTOCOL_END -->
|
|
94
|
-
"""
|
|
14
|
+
PYTHON_PACKAGE_TEMPLATES = ROOT / "ai_execution_protocol" / "templates" / "minimal"
|
|
95
15
|
|
|
96
16
|
|
|
97
17
|
MINIMAL_README = """# Minimal AI Protocol
|
|
@@ -157,18 +77,15 @@ O `install.ps1` tambem roda a verificacao. O resultado esperado e `PASS`.
|
|
|
157
77
|
"""
|
|
158
78
|
|
|
159
79
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
model-runs/generated/
|
|
165
|
-
dist/
|
|
166
|
-
scripts/__pycache__/
|
|
167
|
-
*.pyc
|
|
168
|
-
"""
|
|
80
|
+
def copy_tree(source: Path, target: Path) -> None:
|
|
81
|
+
if target.exists():
|
|
82
|
+
shutil.rmtree(target)
|
|
83
|
+
shutil.copytree(source, target)
|
|
169
84
|
|
|
170
85
|
|
|
171
86
|
def main() -> int:
|
|
87
|
+
manifest = json.loads((ROOT / "install-manifest.json").read_text(encoding="utf-8"))
|
|
88
|
+
protocol_files = manifest["protocol_files"]
|
|
172
89
|
if DIST.exists():
|
|
173
90
|
shutil.rmtree(DIST)
|
|
174
91
|
(DIST / "protocol").mkdir(parents=True, exist_ok=True)
|
|
@@ -176,13 +93,14 @@ def main() -> int:
|
|
|
176
93
|
shutil.rmtree(PYTHON_PACKAGE_PROTOCOL)
|
|
177
94
|
PYTHON_PACKAGE_PROTOCOL.mkdir(parents=True, exist_ok=True)
|
|
178
95
|
|
|
179
|
-
(
|
|
96
|
+
shutil.copytree(ROOT / "templates" / "minimal", DIST, dirs_exist_ok=True)
|
|
180
97
|
(DIST / "README.md").write_text(MINIMAL_README, encoding="utf-8")
|
|
181
|
-
|
|
182
|
-
for name in PROTOCOL_FILES:
|
|
98
|
+
for name in protocol_files:
|
|
183
99
|
shutil.copy2(ROOT / "protocol" / name, DIST / "protocol" / name)
|
|
184
100
|
shutil.copy2(ROOT / "protocol" / name, PYTHON_PACKAGE_PROTOCOL / name)
|
|
185
101
|
(PYTHON_PACKAGE_PROTOCOL / "__init__.py").write_text("", encoding="utf-8")
|
|
102
|
+
shutil.copy2(ROOT / "install-manifest.json", ROOT / "ai_execution_protocol" / "install-manifest.json")
|
|
103
|
+
copy_tree(ROOT / "templates" / "minimal", PYTHON_PACKAGE_TEMPLATES)
|
|
186
104
|
|
|
187
105
|
print(f"built {DIST}")
|
|
188
106
|
return 0
|
|
@@ -6,42 +6,10 @@ const path = require("path");
|
|
|
6
6
|
const root = path.resolve(__dirname, "..");
|
|
7
7
|
const markerStart = "<!-- AI_PROTOCOL_BEGIN -->";
|
|
8
8
|
const markerEnd = "<!-- AI_PROTOCOL_END -->";
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"modes.yaml",
|
|
14
|
-
"execution-rules.yaml",
|
|
15
|
-
"risk-levels.yaml",
|
|
16
|
-
"mapping-checklists.yaml",
|
|
17
|
-
"validation-checklist.yaml",
|
|
18
|
-
"context-rules.yaml",
|
|
19
|
-
"context-compiler.yaml",
|
|
20
|
-
"persistent-context.yaml",
|
|
21
|
-
"formatting-rules.yaml",
|
|
22
|
-
"prompt-economy.yaml",
|
|
23
|
-
"spec-driven.yaml",
|
|
24
|
-
];
|
|
25
|
-
const aiignoreLines = [
|
|
26
|
-
"results/",
|
|
27
|
-
"benchmarks/generated/",
|
|
28
|
-
"model-runs/generated/",
|
|
29
|
-
"dist/",
|
|
30
|
-
"scripts/__pycache__/",
|
|
31
|
-
"*.pyc",
|
|
32
|
-
];
|
|
33
|
-
const requiredText = {
|
|
34
|
-
"AGENTS.md": [
|
|
35
|
-
"AI_PROTOCOL_BEGIN",
|
|
36
|
-
"protocol/fast-path.yaml",
|
|
37
|
-
"protocol/router.yaml",
|
|
38
|
-
"Classifique o risco antes de agir",
|
|
39
|
-
"Nenhum arquivo deve passar de 400 linhas.",
|
|
40
|
-
],
|
|
41
|
-
".aiignore": ["results/", "dist/", "*.pyc"],
|
|
42
|
-
"protocol/router.yaml": ["feature_or_spec", "spec-driven.yaml", "prompt_improvement"],
|
|
43
|
-
"protocol/spec-driven.yaml": ["protocol_is_base_spec_is_tool", "do_not_create_spec_for_low_value_tasks"],
|
|
44
|
-
};
|
|
9
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(root, "install-manifest.json"), "utf8"));
|
|
10
|
+
const protocolFiles = manifest.protocol_files;
|
|
11
|
+
const aiignoreLines = manifest.aiignore_lines;
|
|
12
|
+
const requiredText = manifest.required_text;
|
|
45
13
|
|
|
46
14
|
function readText(file) {
|
|
47
15
|
return fs.readFileSync(file, "utf8");
|
|
@@ -60,69 +28,7 @@ function sourceProtocolDir() {
|
|
|
60
28
|
|
|
61
29
|
function minimalAgents() {
|
|
62
30
|
const file = path.join(root, "dist", "minimal", "AGENTS.md");
|
|
63
|
-
|
|
64
|
-
return `# AGENTS.md
|
|
65
|
-
|
|
66
|
-
## Regra principal
|
|
67
|
-
|
|
68
|
-
${markerStart}
|
|
69
|
-
|
|
70
|
-
Use \`protocol/fast-path.yaml\` como entrada operacional minima.
|
|
71
|
-
|
|
72
|
-
Siga \`.aiignore\` antes de abrir relatorios gerados.
|
|
73
|
-
|
|
74
|
-
Este protocolo e obrigatorio para tarefas tecnicas neste projeto. Antes de
|
|
75
|
-
editar, classifique risco, escolha rota e valide a entrega.
|
|
76
|
-
|
|
77
|
-
## Ordem de leitura
|
|
78
|
-
|
|
79
|
-
1. \`protocol/fast-path.yaml\`
|
|
80
|
-
2. \`protocol/router.yaml\`
|
|
81
|
-
3. Arquivo YAML especifico em \`protocol/\` conforme a rota.
|
|
82
|
-
|
|
83
|
-
## Regras de execucao
|
|
84
|
-
|
|
85
|
-
- Classifique o risco antes de agir.
|
|
86
|
-
- Use o menor contexto suficiente.
|
|
87
|
-
- Leia apenas os arquivos indicados por \`protocol/router.yaml\`.
|
|
88
|
-
- Quando houver contexto grande, historico longo ou risco de confusao, use
|
|
89
|
-
\`protocol/context-compiler.yaml\` antes de abrir muitos arquivos.
|
|
90
|
-
- Use \`protocol/spec-driven.yaml\` para feature, refatoracao grande ou tarefa
|
|
91
|
-
critica, sem criar spec pesada para tarefa simples.
|
|
92
|
-
- Sempre entregue \`Prompt original\` e \`Prompt melhorado da IA\`; em baixo risco,
|
|
93
|
-
prefira micro formato legivel com \`PO\`, \`PM\` e \`OK\`.
|
|
94
|
-
- Nao edite arquivo que nao foi identificado como candidato.
|
|
95
|
-
- Preserve documentos, regras de IDE e configuracoes de framework existentes,
|
|
96
|
-
salvo pedido explicito do usuario.
|
|
97
|
-
- Se o risco subir, atualize a classificacao antes de continuar.
|
|
98
|
-
- Para nivel critico, peca confirmacao antes de acao sensivel.
|
|
99
|
-
- Quando houver risco de quebrar fluxo existente, entregue uma lista do que
|
|
100
|
-
testar.
|
|
101
|
-
- Entregue com evidencia em poucas linhas: mudanca, validacao, limite e risco
|
|
102
|
-
residual.
|
|
103
|
-
- Explique o resultado em linguagem clara para uma pessoa leiga entender.
|
|
104
|
-
|
|
105
|
-
## Convivencia com arquivos existentes
|
|
106
|
-
|
|
107
|
-
Quando houver conflito, siga esta prioridade:
|
|
108
|
-
|
|
109
|
-
1. pedido atual do usuario;
|
|
110
|
-
2. este bloco obrigatorio em \`AGENTS.md\`;
|
|
111
|
-
3. regras especificas da IDE ou do projeto;
|
|
112
|
-
4. docs e historico somente quando a rota pedir.
|
|
113
|
-
|
|
114
|
-
Nao sobrescreva \`README.md\`, \`docs/\`, \`.cursorrules\`, \`CLAUDE.md\`,
|
|
115
|
-
\`.github/copilot-instructions.md\` ou configs de framework sem pedido claro.
|
|
116
|
-
|
|
117
|
-
## Regras de organizacao
|
|
118
|
-
|
|
119
|
-
- Nenhum arquivo deve passar de 400 linhas.
|
|
120
|
-
- Organize primeiro para legibilidade por IA.
|
|
121
|
-
- Use YAML para regras operacionais.
|
|
122
|
-
- Evite duplicar a mesma regra em muitos lugares.
|
|
123
|
-
|
|
124
|
-
${markerEnd}
|
|
125
|
-
`;
|
|
31
|
+
return readText(file);
|
|
126
32
|
}
|
|
127
33
|
|
|
128
34
|
function protocolBlock() {
|
|
@@ -194,6 +100,18 @@ function installAiignore(target) {
|
|
|
194
100
|
writeText(target, existing.join("\n").trim() + "\n");
|
|
195
101
|
}
|
|
196
102
|
|
|
103
|
+
function writeIfMissing(file, text) {
|
|
104
|
+
if (fs.existsSync(file)) return;
|
|
105
|
+
writeText(file, text);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function installContextTemplates(targetRoot) {
|
|
109
|
+
for (const item of manifest.required_files) {
|
|
110
|
+
if (item === "AGENTS.md" || item === ".aiignore") continue;
|
|
111
|
+
writeIfMissing(path.join(targetRoot, item), readText(path.join(root, "dist", "minimal", item)));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
197
115
|
function copyProtocol(target, force, backupRoot) {
|
|
198
116
|
if (fs.existsSync(target) && !force) return;
|
|
199
117
|
if (fs.existsSync(target)) {
|
|
@@ -219,6 +137,7 @@ function install(target, force, dryRun) {
|
|
|
219
137
|
backup(path.join(targetRoot, ".aiignore"), backupRoot);
|
|
220
138
|
installAgents(path.join(targetRoot, "AGENTS.md"));
|
|
221
139
|
installAiignore(path.join(targetRoot, ".aiignore"));
|
|
140
|
+
installContextTemplates(targetRoot);
|
|
222
141
|
copyProtocol(path.join(targetRoot, "protocol"), force, backupRoot);
|
|
223
142
|
console.log(`installed protocol -> ${targetRoot}`);
|
|
224
143
|
return verify(targetRoot);
|
|
@@ -227,7 +146,10 @@ function install(target, force, dryRun) {
|
|
|
227
146
|
function verify(target) {
|
|
228
147
|
const targetRoot = path.resolve(target);
|
|
229
148
|
const errors = [];
|
|
230
|
-
const requiredFiles = [
|
|
149
|
+
const requiredFiles = [
|
|
150
|
+
...manifest.required_files,
|
|
151
|
+
...protocolFiles.map((file) => `protocol/${file}`),
|
|
152
|
+
];
|
|
231
153
|
for (const item of requiredFiles) {
|
|
232
154
|
const file = path.join(targetRoot, item);
|
|
233
155
|
if (!fs.existsSync(file)) {
|
|
@@ -1,76 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""Verify
|
|
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
|
-
|
|
11
|
-
"AGENTS.md",
|
|
12
|
-
".aiignore",
|
|
13
|
-
"protocol/README.yaml",
|
|
14
|
-
"protocol/fast-path.yaml",
|
|
15
|
-
"protocol/router.yaml",
|
|
16
|
-
"protocol/modes.yaml",
|
|
17
|
-
"protocol/execution-rules.yaml",
|
|
18
|
-
"protocol/risk-levels.yaml",
|
|
19
|
-
"protocol/mapping-checklists.yaml",
|
|
20
|
-
"protocol/validation-checklist.yaml",
|
|
21
|
-
"protocol/context-rules.yaml",
|
|
22
|
-
"protocol/context-compiler.yaml",
|
|
23
|
-
"protocol/persistent-context.yaml",
|
|
24
|
-
"protocol/formatting-rules.yaml",
|
|
25
|
-
"protocol/prompt-economy.yaml",
|
|
26
|
-
"protocol/spec-driven.yaml",
|
|
27
|
-
]
|
|
11
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
28
12
|
|
|
29
|
-
REQUIRED_TEXT = {
|
|
30
|
-
"AGENTS.md": [
|
|
31
|
-
"AI_PROTOCOL_BEGIN",
|
|
32
|
-
"protocol/fast-path.yaml",
|
|
33
|
-
"protocol/router.yaml",
|
|
34
|
-
"Classifique o risco antes de agir",
|
|
35
|
-
"Prompt original",
|
|
36
|
-
"Prompt melhorado da IA",
|
|
37
|
-
"lista do que",
|
|
38
|
-
"Nenhum arquivo deve passar de 400 linhas.",
|
|
39
|
-
],
|
|
40
|
-
".aiignore": [
|
|
41
|
-
"results/",
|
|
42
|
-
"dist/",
|
|
43
|
-
"*.pyc",
|
|
44
|
-
],
|
|
45
|
-
"protocol/router.yaml": [
|
|
46
|
-
"feature_or_spec",
|
|
47
|
-
"spec-driven.yaml",
|
|
48
|
-
"prompt_improvement",
|
|
49
|
-
],
|
|
50
|
-
"protocol/spec-driven.yaml": [
|
|
51
|
-
"protocol_is_base_spec_is_tool",
|
|
52
|
-
"do_not_create_spec_for_low_value_tasks",
|
|
53
|
-
],
|
|
54
|
-
}
|
|
55
13
|
|
|
14
|
+
def load_manifest() -> dict:
|
|
15
|
+
return json.loads((ROOT / "install-manifest.json").read_text(encoding="utf-8"))
|
|
56
16
|
|
|
57
|
-
def main() -> int:
|
|
58
|
-
parser = argparse.ArgumentParser()
|
|
59
|
-
parser.add_argument("--target", required=True, help="Project root to verify")
|
|
60
|
-
args = parser.parse_args()
|
|
61
|
-
|
|
62
|
-
root = Path(args.target).resolve()
|
|
63
|
-
errors: list[str] = []
|
|
64
17
|
|
|
65
|
-
|
|
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:
|
|
66
25
|
path = root / item
|
|
67
26
|
if not path.exists():
|
|
68
27
|
errors.append(f"missing:{item}")
|
|
69
28
|
continue
|
|
70
29
|
if path.is_file() and len(path.read_text(encoding="utf-8").splitlines()) > 400:
|
|
71
30
|
errors.append(f"line_limit:{item}")
|
|
72
|
-
|
|
73
|
-
for item, snippets in REQUIRED_TEXT.items():
|
|
31
|
+
for item, snippets in manifest["required_text"].items():
|
|
74
32
|
path = root / item
|
|
75
33
|
if not path.exists() or not path.is_file():
|
|
76
34
|
continue
|
|
@@ -78,15 +36,18 @@ def main() -> int:
|
|
|
78
36
|
for snippet in snippets:
|
|
79
37
|
if snippet not in text:
|
|
80
38
|
errors.append(f"missing_text:{item}:{snippet}")
|
|
39
|
+
return errors
|
|
81
40
|
|
|
82
|
-
if errors:
|
|
83
|
-
print("FAIL")
|
|
84
|
-
for error in errors:
|
|
85
|
-
print(error)
|
|
86
|
-
return 1
|
|
87
41
|
|
|
88
|
-
|
|
89
|
-
|
|
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
|
|
90
51
|
|
|
91
52
|
|
|
92
53
|
if __name__ == "__main__":
|
|
@@ -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,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,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
|