tribunal-kit 4.3.1 → 4.4.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.
Files changed (67) hide show
  1. package/.agent/agents/api-architect.md +66 -66
  2. package/.agent/agents/db-latency-auditor.md +216 -216
  3. package/.agent/agents/precedence-reviewer.md +250 -250
  4. package/.agent/agents/resilience-reviewer.md +88 -88
  5. package/.agent/agents/schema-reviewer.md +67 -67
  6. package/.agent/agents/throughput-optimizer.md +299 -299
  7. package/.agent/agents/ui-ux-auditor.md +292 -292
  8. package/.agent/agents/vitals-reviewer.md +223 -223
  9. package/.agent/scripts/_colors.js +18 -18
  10. package/.agent/scripts/_utils.js +42 -42
  11. package/.agent/scripts/append_flow.js +72 -72
  12. package/.agent/scripts/auto_preview.js +197 -197
  13. package/.agent/scripts/bundle_analyzer.js +290 -290
  14. package/.agent/scripts/case_law_manager.js +17 -6
  15. package/.agent/scripts/checklist.js +266 -266
  16. package/.agent/scripts/colors.js +17 -17
  17. package/.agent/scripts/compress_skills.js +141 -141
  18. package/.agent/scripts/consolidate_skills.js +149 -149
  19. package/.agent/scripts/context_broker.js +611 -609
  20. package/.agent/scripts/deep_compress.js +150 -150
  21. package/.agent/scripts/dependency_analyzer.js +272 -272
  22. package/.agent/scripts/graph_builder.js +151 -37
  23. package/.agent/scripts/graph_visualizer.js +384 -0
  24. package/.agent/scripts/inner_loop_validator.js +451 -465
  25. package/.agent/scripts/lint_runner.js +187 -187
  26. package/.agent/scripts/minify_context.js +100 -100
  27. package/.agent/scripts/mutation_runner.js +280 -0
  28. package/.agent/scripts/patch_skills_meta.js +156 -156
  29. package/.agent/scripts/patch_skills_output.js +244 -244
  30. package/.agent/scripts/schema_validator.js +297 -297
  31. package/.agent/scripts/security_scan.js +303 -303
  32. package/.agent/scripts/session_manager.js +276 -276
  33. package/.agent/scripts/skill_evolution.js +644 -644
  34. package/.agent/scripts/skill_integrator.js +313 -313
  35. package/.agent/scripts/strengthen_skills.js +193 -193
  36. package/.agent/scripts/strip_tribunal.js +47 -47
  37. package/.agent/scripts/swarm_dispatcher.js +360 -360
  38. package/.agent/scripts/test_runner.js +193 -193
  39. package/.agent/scripts/utils.js +32 -32
  40. package/.agent/scripts/verify_all.js +257 -256
  41. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
  42. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
  43. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
  44. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
  45. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
  46. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
  47. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
  48. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
  49. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
  50. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
  51. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
  52. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
  53. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
  54. package/.agent/skills/doc.md +1 -1
  55. package/.agent/skills/knowledge-graph/SKILL.md +32 -16
  56. package/.agent/skills/testing-patterns/SKILL.md +19 -2
  57. package/.agent/skills/ui-ux-pro-max/SKILL.md +480 -43
  58. package/.agent/workflows/generate.md +183 -183
  59. package/.agent/workflows/tribunal-speed.md +183 -183
  60. package/README.md +1 -1
  61. package/bin/tribunal-kit.js +134 -17
  62. package/package.json +6 -3
  63. package/scripts/changelog.js +167 -167
  64. package/scripts/sync-version.js +81 -81
  65. package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
  66. package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
  67. package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
@@ -1,193 +1,193 @@
1
- #!/usr/bin/env node
2
- /**
3
- * strengthen_skills.js — Appends Tribunal guardrails to SKILL.md files missing them.
4
- *
5
- * Usage:
6
- * node .agent/scripts/strengthen_skills.js .
7
- * node .agent/scripts/strengthen_skills.js . --dry-run
8
- * node .agent/scripts/strengthen_skills.js . --skill python-pro
9
- * node .agent/scripts/strengthen_skills.js . --skills-path /custom/skills/dir
10
- */
11
-
12
- 'use strict';
13
-
14
- const fs = require('fs');
15
- const path = require('path');
16
-
17
- const { RED, GREEN, YELLOW, BLUE, BOLD, RESET } = require('./colors.js');
18
-
19
- const GUARDRAILS_BLOCK = `
20
-
21
- ---
22
-
23
- ## 🤖 LLM-Specific Traps
24
-
25
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
26
-
27
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
28
- 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always \`// VERIFY\` or check \`package.json\` / \`requirements.txt\`.
29
- 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
30
- 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
31
- 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
32
-
33
- ---
34
-
35
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
36
-
37
- **Slash command: \`/review\` or \`/tribunal-full\`**
38
- **Active reviewers: \`logic-reviewer\` · \`security-auditor\`**
39
-
40
- ### ❌ Forbidden AI Tropes
41
-
42
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with \`// VERIFY: [reason]\`.
43
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
44
- 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
45
-
46
- ### ✅ Pre-Flight Self-Audit
47
-
48
- Review these questions before confirming output:
49
- \`\`\`
50
- ✅ Did I rely ONLY on real, verified tools and methods?
51
- ✅ Is this solution appropriately scoped to the user's constraints?
52
- ✅ Did I handle potential failure modes and edge cases?
53
- ✅ Have I avoided generic boilerplate that doesn't add value?
54
- \`\`\`
55
-
56
- ### 🛑 Verification-Before-Completion (VBC) Protocol
57
-
58
- **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
59
- - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
60
- - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
61
- `;
62
-
63
- const TRIBUNAL_MARKERS = [
64
- "Tribunal Integration",
65
- "Tribunal Integration (Anti-Hallucination)",
66
- ];
67
-
68
- const VBC_MARKERS = [
69
- "Verification-Before-Completion",
70
- "VBC Protocol",
71
- ];
72
-
73
- function hasTribunalBlock(content) {
74
- return TRIBUNAL_MARKERS.some(m => content.includes(m));
75
- }
76
-
77
- function hasVbcBlock(content) {
78
- return VBC_MARKERS.some(m => content.includes(m));
79
- }
80
-
81
- function header(title) { console.log(`\n${BOLD}${BLUE}━━━ ${title} ━━━${RESET}`); }
82
- function ok(msg) { console.log(` ${GREEN}✅ ${msg}${RESET}`); }
83
- function skip(msg) { console.log(` ${YELLOW}⏭️ ${msg}${RESET}`); }
84
- function warn(msg) { console.log(` ${YELLOW}⚠️ ${msg}${RESET}`); }
85
- function fail(msg) { console.log(` ${RED}❌ ${msg}${RESET}`); }
86
-
87
- function processSkill(skillMd, dryRun) {
88
- const skillName = path.basename(path.dirname(skillMd));
89
- try {
90
- const content = fs.readFileSync(skillMd, 'utf8');
91
- const hasTribunal = hasTribunalBlock(content);
92
- const hasVbc = hasVbcBlock(content);
93
-
94
- if (hasTribunal && hasVbc) {
95
- skip(`${skillName} — already has Tribunal + VBC blocks`);
96
- return "skipped";
97
- }
98
-
99
- const missing = [];
100
- if (!hasTribunal) missing.push("Tribunal Integration");
101
- if (!hasVbc) missing.push("VBC Protocol");
102
-
103
- if (dryRun) {
104
- warn(`[DRY RUN] ${skillName} — would add: ${missing.join(', ')}`);
105
- return "updated";
106
- }
107
-
108
- fs.appendFileSync(skillMd, GUARDRAILS_BLOCK, 'utf8');
109
- ok(`${skillName} — strengthened (${missing.join(', ')} added)`);
110
- return "updated";
111
- } catch (e) {
112
- fail(`${skillName} — ${e.message}`);
113
- return "error";
114
- }
115
- }
116
-
117
- function main() {
118
- const args = process.argv.slice(2);
119
- let targetPath = ".";
120
- let dryRun = false;
121
- let skillArg = null;
122
- let skillsPathArg = null;
123
-
124
- let i = 0;
125
- while (i < args.length) {
126
- if (args[i] === '--dry-run') {
127
- dryRun = true;
128
- } else if (args[i] === '--skill' && i + 1 < args.length) {
129
- skillArg = args[++i];
130
- } else if (args[i] === '--skills-path' && i + 1 < args.length) {
131
- skillsPathArg = args[++i];
132
- } else if (args[i] === '-h' || args[i] === '--help') {
133
- console.log("Usage: node strengthen_skills.js <path> [--dry-run] [--skill <name>] [--skills-path <path>]");
134
- process.exit(0);
135
- } else if (!args[i].startsWith('-')) {
136
- targetPath = args[i];
137
- }
138
- i++;
139
- }
140
-
141
- const projectRoot = path.resolve(targetPath);
142
- let skillsDir;
143
- if (skillsPathArg) {
144
- skillsDir = path.resolve(skillsPathArg);
145
- } else {
146
- skillsDir = path.join(projectRoot, ".agent", "skills");
147
- }
148
-
149
- if (!fs.existsSync(skillsDir) || !fs.statSync(skillsDir).isDirectory()) {
150
- fail(`Skills directory not found: ${skillsDir}`);
151
- process.exit(1);
152
- }
153
-
154
- console.log(`${BOLD}Tribunal — strengthen_skills.js${RESET}`);
155
- if (dryRun) console.log(` ${YELLOW}DRY RUN — no files will be written${RESET}`);
156
- console.log(`Skills dir: ${skillsDir}\n`);
157
-
158
- const counts = { updated: 0, skipped: 0, error: 0 };
159
- header("Strengthening Skills");
160
-
161
- const dirs = fs.readdirSync(skillsDir, { withFileTypes: true });
162
- dirs.sort((a, b) => a.name.localeCompare(b.name));
163
-
164
- for (const dir of dirs) {
165
- if (!dir.isDirectory()) continue;
166
- if (skillArg && dir.name !== skillArg) continue;
167
-
168
- const skillMd = path.join(skillsDir, dir.name, "SKILL.md");
169
- if (!fs.existsSync(skillMd)) {
170
- warn(`${dir.name} — no SKILL.md found`);
171
- continue;
172
- }
173
-
174
- const result = processSkill(skillMd, dryRun);
175
- counts[result]++;
176
- }
177
-
178
- console.log(`\n${BOLD}━━━ Summary ━━━${RESET}`);
179
- console.log(` ${GREEN}✅ Strengthened: ${counts.updated}${RESET}`);
180
- console.log(` ${YELLOW}⏭️ Skipped: ${counts.skipped}${RESET}`);
181
- if (counts.error > 0) {
182
- console.log(` ${RED}❌ Errors: ${counts.error}${RESET}`);
183
- }
184
- if (dryRun) {
185
- console.log(` ${YELLOW}(dry-run — nothing written)${RESET}`);
186
- }
187
-
188
- process.exit(counts.error > 0 ? 1 : 0);
189
- }
190
-
191
- if (require.main === module) {
192
- main();
193
- }
1
+ #!/usr/bin/env node
2
+ /**
3
+ * strengthen_skills.js — Appends Tribunal guardrails to SKILL.md files missing them.
4
+ *
5
+ * Usage:
6
+ * node .agent/scripts/strengthen_skills.js .
7
+ * node .agent/scripts/strengthen_skills.js . --dry-run
8
+ * node .agent/scripts/strengthen_skills.js . --skill python-pro
9
+ * node .agent/scripts/strengthen_skills.js . --skills-path /custom/skills/dir
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ const fs = require('fs');
15
+ const path = require('path');
16
+
17
+ const { RED, GREEN, YELLOW, BLUE, BOLD, RESET } = require('./colors.js');
18
+
19
+ const GUARDRAILS_BLOCK = `
20
+
21
+ ---
22
+
23
+ ## 🤖 LLM-Specific Traps
24
+
25
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
26
+
27
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
28
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always \`// VERIFY\` or check \`package.json\` / \`requirements.txt\`.
29
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
30
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
31
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
32
+
33
+ ---
34
+
35
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
36
+
37
+ **Slash command: \`/review\` or \`/tribunal-full\`**
38
+ **Active reviewers: \`logic-reviewer\` · \`security-auditor\`**
39
+
40
+ ### ❌ Forbidden AI Tropes
41
+
42
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with \`// VERIFY: [reason]\`.
43
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
44
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
45
+
46
+ ### ✅ Pre-Flight Self-Audit
47
+
48
+ Review these questions before confirming output:
49
+ \`\`\`
50
+ ✅ Did I rely ONLY on real, verified tools and methods?
51
+ ✅ Is this solution appropriately scoped to the user's constraints?
52
+ ✅ Did I handle potential failure modes and edge cases?
53
+ ✅ Have I avoided generic boilerplate that doesn't add value?
54
+ \`\`\`
55
+
56
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
57
+
58
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
59
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
60
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
61
+ `;
62
+
63
+ const TRIBUNAL_MARKERS = [
64
+ "Tribunal Integration",
65
+ "Tribunal Integration (Anti-Hallucination)",
66
+ ];
67
+
68
+ const VBC_MARKERS = [
69
+ "Verification-Before-Completion",
70
+ "VBC Protocol",
71
+ ];
72
+
73
+ function hasTribunalBlock(content) {
74
+ return TRIBUNAL_MARKERS.some(m => content.includes(m));
75
+ }
76
+
77
+ function hasVbcBlock(content) {
78
+ return VBC_MARKERS.some(m => content.includes(m));
79
+ }
80
+
81
+ function header(title) { console.log(`\n${BOLD}${BLUE}━━━ ${title} ━━━${RESET}`); }
82
+ function ok(msg) { console.log(` ${GREEN}✅ ${msg}${RESET}`); }
83
+ function skip(msg) { console.log(` ${YELLOW}⏭️ ${msg}${RESET}`); }
84
+ function warn(msg) { console.log(` ${YELLOW}⚠️ ${msg}${RESET}`); }
85
+ function fail(msg) { console.log(` ${RED}❌ ${msg}${RESET}`); }
86
+
87
+ function processSkill(skillMd, dryRun) {
88
+ const skillName = path.basename(path.dirname(skillMd));
89
+ try {
90
+ const content = fs.readFileSync(skillMd, 'utf8');
91
+ const hasTribunal = hasTribunalBlock(content);
92
+ const hasVbc = hasVbcBlock(content);
93
+
94
+ if (hasTribunal && hasVbc) {
95
+ skip(`${skillName} — already has Tribunal + VBC blocks`);
96
+ return "skipped";
97
+ }
98
+
99
+ const missing = [];
100
+ if (!hasTribunal) missing.push("Tribunal Integration");
101
+ if (!hasVbc) missing.push("VBC Protocol");
102
+
103
+ if (dryRun) {
104
+ warn(`[DRY RUN] ${skillName} — would add: ${missing.join(', ')}`);
105
+ return "updated";
106
+ }
107
+
108
+ fs.appendFileSync(skillMd, GUARDRAILS_BLOCK, 'utf8');
109
+ ok(`${skillName} — strengthened (${missing.join(', ')} added)`);
110
+ return "updated";
111
+ } catch (e) {
112
+ fail(`${skillName} — ${e.message}`);
113
+ return "error";
114
+ }
115
+ }
116
+
117
+ function main() {
118
+ const args = process.argv.slice(2);
119
+ let targetPath = ".";
120
+ let dryRun = false;
121
+ let skillArg = null;
122
+ let skillsPathArg = null;
123
+
124
+ let i = 0;
125
+ while (i < args.length) {
126
+ if (args[i] === '--dry-run') {
127
+ dryRun = true;
128
+ } else if (args[i] === '--skill' && i + 1 < args.length) {
129
+ skillArg = args[++i];
130
+ } else if (args[i] === '--skills-path' && i + 1 < args.length) {
131
+ skillsPathArg = args[++i];
132
+ } else if (args[i] === '-h' || args[i] === '--help') {
133
+ console.log("Usage: node strengthen_skills.js <path> [--dry-run] [--skill <name>] [--skills-path <path>]");
134
+ process.exit(0);
135
+ } else if (!args[i].startsWith('-')) {
136
+ targetPath = args[i];
137
+ }
138
+ i++;
139
+ }
140
+
141
+ const projectRoot = path.resolve(targetPath);
142
+ let skillsDir;
143
+ if (skillsPathArg) {
144
+ skillsDir = path.resolve(skillsPathArg);
145
+ } else {
146
+ skillsDir = path.join(projectRoot, ".agent", "skills");
147
+ }
148
+
149
+ if (!fs.existsSync(skillsDir) || !fs.statSync(skillsDir).isDirectory()) {
150
+ fail(`Skills directory not found: ${skillsDir}`);
151
+ process.exit(1);
152
+ }
153
+
154
+ console.log(`${BOLD}Tribunal — strengthen_skills.js${RESET}`);
155
+ if (dryRun) console.log(` ${YELLOW}DRY RUN — no files will be written${RESET}`);
156
+ console.log(`Skills dir: ${skillsDir}\n`);
157
+
158
+ const counts = { updated: 0, skipped: 0, error: 0 };
159
+ header("Strengthening Skills");
160
+
161
+ const dirs = fs.readdirSync(skillsDir, { withFileTypes: true });
162
+ dirs.sort((a, b) => a.name.localeCompare(b.name));
163
+
164
+ for (const dir of dirs) {
165
+ if (!dir.isDirectory()) continue;
166
+ if (skillArg && dir.name !== skillArg) continue;
167
+
168
+ const skillMd = path.join(skillsDir, dir.name, "SKILL.md");
169
+ if (!fs.existsSync(skillMd)) {
170
+ warn(`${dir.name} — no SKILL.md found`);
171
+ continue;
172
+ }
173
+
174
+ const result = processSkill(skillMd, dryRun);
175
+ counts[result]++;
176
+ }
177
+
178
+ console.log(`\n${BOLD}━━━ Summary ━━━${RESET}`);
179
+ console.log(` ${GREEN}✅ Strengthened: ${counts.updated}${RESET}`);
180
+ console.log(` ${YELLOW}⏭️ Skipped: ${counts.skipped}${RESET}`);
181
+ if (counts.error > 0) {
182
+ console.log(` ${RED}❌ Errors: ${counts.error}${RESET}`);
183
+ }
184
+ if (dryRun) {
185
+ console.log(` ${YELLOW}(dry-run — nothing written)${RESET}`);
186
+ }
187
+
188
+ process.exit(counts.error > 0 ? 1 : 0);
189
+ }
190
+
191
+ if (require.main === module) {
192
+ main();
193
+ }
@@ -1,47 +1,47 @@
1
- #!/usr/bin/env node
2
- /**
3
- * strip_tribunal.js
4
- */
5
- 'use strict';
6
-
7
- const fs = require('fs');
8
- const path = require('path');
9
-
10
- function stripBoilerplate(filePath) {
11
- const original = fs.readFileSync(filePath, 'utf8');
12
- const originalLen = Buffer.byteLength(original, 'utf8');
13
-
14
- let content = original;
15
- content = content.replace(/## 🏛️ Tribunal Integration[\s\S]*?(?=\n# |\Z)/g, '');
16
- content = content.replace(/## Tribunal Integration[\s\S]*?(?=\n# |\Z)/g, '');
17
- content = content.replace(/## Cross-Workflow Navigation[\s\S]*?(?=\n# |\Z)/g, '');
18
- content = content.replace(/## What the Maker Is Not Allowed to Do[\s\S]*?(?=\n# |\Z)/g, '');
19
-
20
- fs.writeFileSync(filePath, content.trim() + '\n', 'utf8');
21
- const newLen = Buffer.byteLength(content.trim() + '\n', 'utf8');
22
-
23
- return [originalLen, newLen];
24
- }
25
-
26
- function main() {
27
- const dirsToCheck = ['.agent/agents', '.agent/workflows'];
28
- let totalStripped = 0;
29
-
30
- for (const d of dirsToCheck) {
31
- if (!fs.existsSync(d)) continue;
32
- const files = fs.readdirSync(d);
33
- for (const file of files) {
34
- if (file.endsWith('.md')) {
35
- const filePath = path.join(d, file);
36
- const [orig, newL] = stripBoilerplate(filePath);
37
- totalStripped += (orig - newL);
38
- }
39
- }
40
- }
41
-
42
- console.log(`Stripped ${totalStripped} bytes of repetitive boilerplate.`);
43
- }
44
-
45
- if (require.main === module) {
46
- main();
47
- }
1
+ #!/usr/bin/env node
2
+ /**
3
+ * strip_tribunal.js
4
+ */
5
+ 'use strict';
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+
10
+ function stripBoilerplate(filePath) {
11
+ const original = fs.readFileSync(filePath, 'utf8');
12
+ const originalLen = Buffer.byteLength(original, 'utf8');
13
+
14
+ let content = original;
15
+ content = content.replace(/## 🏛️ Tribunal Integration[\s\S]*?(?=\n# |\Z)/g, '');
16
+ content = content.replace(/## Tribunal Integration[\s\S]*?(?=\n# |\Z)/g, '');
17
+ content = content.replace(/## Cross-Workflow Navigation[\s\S]*?(?=\n# |\Z)/g, '');
18
+ content = content.replace(/## What the Maker Is Not Allowed to Do[\s\S]*?(?=\n# |\Z)/g, '');
19
+
20
+ fs.writeFileSync(filePath, content.trim() + '\n', 'utf8');
21
+ const newLen = Buffer.byteLength(content.trim() + '\n', 'utf8');
22
+
23
+ return [originalLen, newLen];
24
+ }
25
+
26
+ function main() {
27
+ const dirsToCheck = ['.agent/agents', '.agent/workflows'];
28
+ let totalStripped = 0;
29
+
30
+ for (const d of dirsToCheck) {
31
+ if (!fs.existsSync(d)) continue;
32
+ const files = fs.readdirSync(d);
33
+ for (const file of files) {
34
+ if (file.endsWith('.md')) {
35
+ const filePath = path.join(d, file);
36
+ const [orig, newL] = stripBoilerplate(filePath);
37
+ totalStripped += (orig - newL);
38
+ }
39
+ }
40
+ }
41
+
42
+ console.log(`Stripped ${totalStripped} bytes of repetitive boilerplate.`);
43
+ }
44
+
45
+ if (require.main === module) {
46
+ main();
47
+ }