tribunal-kit 2.4.2 โ 2.4.4
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/.agent/patterns/generator.md +9 -0
- package/.agent/patterns/inversion.md +12 -0
- package/.agent/patterns/pipeline.md +9 -0
- package/.agent/patterns/reviewer.md +13 -0
- package/.agent/patterns/tool-wrapper.md +9 -0
- package/.agent/scripts/patch_skills_meta.py +177 -177
- package/.agent/scripts/patch_skills_output.py +285 -285
- package/.agent/scripts/strengthen_skills.py +220 -220
- package/.agent/scripts/swarm_dispatcher.py +34 -1
- package/.agent/skills/documentation-templates/SKILL.md +17 -0
- package/.agent/skills/github-operations/SKILL.md +354 -354
- package/.agent/skills/readme-builder/SKILL.md +270 -270
- package/.agent/workflows/strengthen-skills.md +99 -99
- package/bin/tribunal-kit.js +547 -542
- package/package.json +53 -38
|
@@ -1,220 +1,220 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
strengthen_skills.py โ Appends Tribunal guardrails to SKILL.md files missing them.
|
|
4
|
-
|
|
5
|
-
Adds the following sections if not already present:
|
|
6
|
-
- ## ๐ค LLM-Specific Traps
|
|
7
|
-
- ## ๐๏ธ Tribunal Integration (Anti-Hallucination)
|
|
8
|
-
- โ Forbidden AI Tropes
|
|
9
|
-
- โ
Pre-Flight Self-Audit
|
|
10
|
-
- ๐ Verification-Before-Completion (VBC) Protocol
|
|
11
|
-
|
|
12
|
-
Usage:
|
|
13
|
-
python .agent/scripts/strengthen_skills.py .
|
|
14
|
-
python .agent/scripts/strengthen_skills.py . --dry-run
|
|
15
|
-
python .agent/scripts/strengthen_skills.py . --skill python-pro
|
|
16
|
-
python .agent/scripts/strengthen_skills.py . --path /custom/skills/dir
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
import os
|
|
20
|
-
import sys
|
|
21
|
-
import argparse
|
|
22
|
-
from pathlib import Path
|
|
23
|
-
|
|
24
|
-
RED = "\033[91m"
|
|
25
|
-
GREEN = "\033[92m"
|
|
26
|
-
YELLOW = "\033[93m"
|
|
27
|
-
BLUE = "\033[94m"
|
|
28
|
-
BOLD = "\033[1m"
|
|
29
|
-
RESET = "\033[0m"
|
|
30
|
-
|
|
31
|
-
# โโโ Rich guardrails block โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
32
|
-
# This is the canonical template appended to skills missing Tribunal sections.
|
|
33
|
-
|
|
34
|
-
GUARDRAILS_BLOCK = """
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## ๐ค LLM-Specific Traps
|
|
39
|
-
|
|
40
|
-
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
41
|
-
|
|
42
|
-
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
43
|
-
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
44
|
-
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
45
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
46
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## ๐๏ธ Tribunal Integration (Anti-Hallucination)
|
|
51
|
-
|
|
52
|
-
**Slash command: `/review` or `/tribunal-full`**
|
|
53
|
-
**Active reviewers: `logic-reviewer` ยท `security-auditor`**
|
|
54
|
-
|
|
55
|
-
### โ Forbidden AI Tropes
|
|
56
|
-
|
|
57
|
-
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
58
|
-
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
59
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
60
|
-
|
|
61
|
-
### โ
Pre-Flight Self-Audit
|
|
62
|
-
|
|
63
|
-
Review these questions before confirming output:
|
|
64
|
-
```
|
|
65
|
-
โ
Did I rely ONLY on real, verified tools and methods?
|
|
66
|
-
โ
Is this solution appropriately scoped to the user's constraints?
|
|
67
|
-
โ
Did I handle potential failure modes and edge cases?
|
|
68
|
-
โ
Have I avoided generic boilerplate that doesn't add value?
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### ๐ Verification-Before-Completion (VBC) Protocol
|
|
72
|
-
|
|
73
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
74
|
-
- โ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
75
|
-
- โ
**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.
|
|
76
|
-
"""
|
|
77
|
-
|
|
78
|
-
# โโโ Detection โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
79
|
-
|
|
80
|
-
TRIBUNAL_MARKERS = [
|
|
81
|
-
"Tribunal Integration",
|
|
82
|
-
"Tribunal Integration (Anti-Hallucination)",
|
|
83
|
-
]
|
|
84
|
-
|
|
85
|
-
VBC_MARKERS = [
|
|
86
|
-
"Verification-Before-Completion",
|
|
87
|
-
"VBC Protocol",
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def has_tribunal_block(content: str) -> bool:
|
|
92
|
-
return any(marker in content for marker in TRIBUNAL_MARKERS)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def has_vbc_block(content: str) -> bool:
|
|
96
|
-
return any(marker in content for marker in VBC_MARKERS)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
# โโโ Output helpers โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
100
|
-
|
|
101
|
-
def header(title: str) -> None:
|
|
102
|
-
print(f"\n{BOLD}{BLUE}โโโ {title} โโโ{RESET}")
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def ok(msg: str) -> None:
|
|
106
|
-
print(f" {GREEN}โ
{msg}{RESET}")
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
def skip(msg: str) -> None:
|
|
110
|
-
print(f" {YELLOW}โญ๏ธ {msg}{RESET}")
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def warn(msg: str) -> None:
|
|
114
|
-
print(f" {YELLOW}โ ๏ธ {msg}{RESET}")
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def fail(msg: str) -> None:
|
|
118
|
-
print(f" {RED}โ {msg}{RESET}")
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
# โโโ Core โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
122
|
-
|
|
123
|
-
def process_skill(skill_md: Path, dry_run: bool) -> str:
|
|
124
|
-
"""Process a single SKILL.md. Returns 'updated', 'skipped', or 'error'."""
|
|
125
|
-
skill_name = skill_md.parent.name
|
|
126
|
-
try:
|
|
127
|
-
content = skill_md.read_text(encoding="utf-8")
|
|
128
|
-
|
|
129
|
-
has_tribunal = has_tribunal_block(content)
|
|
130
|
-
has_vbc = has_vbc_block(content)
|
|
131
|
-
|
|
132
|
-
if has_tribunal and has_vbc:
|
|
133
|
-
skip(f"{skill_name} โ already has Tribunal + VBC blocks")
|
|
134
|
-
return "skipped"
|
|
135
|
-
|
|
136
|
-
missing = []
|
|
137
|
-
if not has_tribunal:
|
|
138
|
-
missing.append("Tribunal Integration")
|
|
139
|
-
if not has_vbc:
|
|
140
|
-
missing.append("VBC Protocol")
|
|
141
|
-
|
|
142
|
-
if dry_run:
|
|
143
|
-
warn(f"[DRY RUN] {skill_name} โ would add: {', '.join(missing)}")
|
|
144
|
-
return "updated"
|
|
145
|
-
|
|
146
|
-
with skill_md.open("a", encoding="utf-8") as f:
|
|
147
|
-
f.write(GUARDRAILS_BLOCK)
|
|
148
|
-
|
|
149
|
-
ok(f"{skill_name} โ strengthened ({', '.join(missing)} added)")
|
|
150
|
-
return "updated"
|
|
151
|
-
|
|
152
|
-
except Exception as e:
|
|
153
|
-
fail(f"{skill_name} โ {e}")
|
|
154
|
-
return "error"
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
# โโโ Main โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
158
|
-
|
|
159
|
-
def main() -> None:
|
|
160
|
-
parser = argparse.ArgumentParser(
|
|
161
|
-
description="Appends Tribunal guardrails (LLM Traps + Pre-Flight + VBC) to skills missing them"
|
|
162
|
-
)
|
|
163
|
-
parser.add_argument(
|
|
164
|
-
"path",
|
|
165
|
-
nargs="?",
|
|
166
|
-
default=".",
|
|
167
|
-
help="Project root directory (default: current directory)"
|
|
168
|
-
)
|
|
169
|
-
parser.add_argument("--dry-run", action="store_true", help="Show changes without writing")
|
|
170
|
-
parser.add_argument("--skill", help="Only strengthen a specific skill by name")
|
|
171
|
-
parser.add_argument(
|
|
172
|
-
"--skills-path",
|
|
173
|
-
help="Override the skills directory path (default: <path>/.agent/skills)"
|
|
174
|
-
)
|
|
175
|
-
args = parser.parse_args()
|
|
176
|
-
|
|
177
|
-
project_root = Path(args.path).resolve()
|
|
178
|
-
skills_dir = (
|
|
179
|
-
Path(args.skills_path).resolve()
|
|
180
|
-
if args.skills_path
|
|
181
|
-
else project_root / ".agent" / "skills"
|
|
182
|
-
)
|
|
183
|
-
|
|
184
|
-
if not skills_dir.is_dir():
|
|
185
|
-
fail(f"Skills directory not found: {skills_dir}")
|
|
186
|
-
sys.exit(1)
|
|
187
|
-
|
|
188
|
-
print(f"{BOLD}Tribunal โ strengthen_skills.py{RESET}")
|
|
189
|
-
if args.dry_run:
|
|
190
|
-
print(f" {YELLOW}DRY RUN โ no files will be written{RESET}")
|
|
191
|
-
print(f"Skills dir: {skills_dir}\n")
|
|
192
|
-
|
|
193
|
-
counts: dict[str, int] = {"updated": 0, "skipped": 0, "error": 0}
|
|
194
|
-
|
|
195
|
-
header("Strengthening Skills")
|
|
196
|
-
for skill_dir in sorted(skills_dir.iterdir()):
|
|
197
|
-
if not skill_dir.is_dir():
|
|
198
|
-
continue
|
|
199
|
-
if args.skill and skill_dir.name != args.skill:
|
|
200
|
-
continue
|
|
201
|
-
skill_md = skill_dir / "SKILL.md"
|
|
202
|
-
if not skill_md.exists():
|
|
203
|
-
warn(f"{skill_dir.name} โ no SKILL.md found")
|
|
204
|
-
continue
|
|
205
|
-
result = process_skill(skill_md, args.dry_run)
|
|
206
|
-
counts[result] += 1
|
|
207
|
-
|
|
208
|
-
print(f"\n{BOLD}โโโ Summary โโโ{RESET}")
|
|
209
|
-
print(f" {GREEN}โ
Strengthened: {counts['updated']}{RESET}")
|
|
210
|
-
print(f" {YELLOW}โญ๏ธ Skipped: {counts['skipped']}{RESET}")
|
|
211
|
-
if counts["error"]:
|
|
212
|
-
print(f" {RED}โ Errors: {counts['error']}{RESET}")
|
|
213
|
-
if args.dry_run:
|
|
214
|
-
print(f" {YELLOW}(dry-run โ nothing written){RESET}")
|
|
215
|
-
|
|
216
|
-
sys.exit(1 if counts["error"] > 0 else 0)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if __name__ == "__main__":
|
|
220
|
-
main()
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
strengthen_skills.py โ Appends Tribunal guardrails to SKILL.md files missing them.
|
|
4
|
+
|
|
5
|
+
Adds the following sections if not already present:
|
|
6
|
+
- ## ๐ค LLM-Specific Traps
|
|
7
|
+
- ## ๐๏ธ Tribunal Integration (Anti-Hallucination)
|
|
8
|
+
- โ Forbidden AI Tropes
|
|
9
|
+
- โ
Pre-Flight Self-Audit
|
|
10
|
+
- ๐ Verification-Before-Completion (VBC) Protocol
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
python .agent/scripts/strengthen_skills.py .
|
|
14
|
+
python .agent/scripts/strengthen_skills.py . --dry-run
|
|
15
|
+
python .agent/scripts/strengthen_skills.py . --skill python-pro
|
|
16
|
+
python .agent/scripts/strengthen_skills.py . --path /custom/skills/dir
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import os
|
|
20
|
+
import sys
|
|
21
|
+
import argparse
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
|
|
24
|
+
RED = "\033[91m"
|
|
25
|
+
GREEN = "\033[92m"
|
|
26
|
+
YELLOW = "\033[93m"
|
|
27
|
+
BLUE = "\033[94m"
|
|
28
|
+
BOLD = "\033[1m"
|
|
29
|
+
RESET = "\033[0m"
|
|
30
|
+
|
|
31
|
+
# โโโ Rich guardrails block โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
32
|
+
# This is the canonical template appended to skills missing Tribunal sections.
|
|
33
|
+
|
|
34
|
+
GUARDRAILS_BLOCK = """
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## ๐ค LLM-Specific Traps
|
|
39
|
+
|
|
40
|
+
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
41
|
+
|
|
42
|
+
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
43
|
+
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
44
|
+
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
45
|
+
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
46
|
+
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## ๐๏ธ Tribunal Integration (Anti-Hallucination)
|
|
51
|
+
|
|
52
|
+
**Slash command: `/review` or `/tribunal-full`**
|
|
53
|
+
**Active reviewers: `logic-reviewer` ยท `security-auditor`**
|
|
54
|
+
|
|
55
|
+
### โ Forbidden AI Tropes
|
|
56
|
+
|
|
57
|
+
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
58
|
+
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
59
|
+
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
60
|
+
|
|
61
|
+
### โ
Pre-Flight Self-Audit
|
|
62
|
+
|
|
63
|
+
Review these questions before confirming output:
|
|
64
|
+
```
|
|
65
|
+
โ
Did I rely ONLY on real, verified tools and methods?
|
|
66
|
+
โ
Is this solution appropriately scoped to the user's constraints?
|
|
67
|
+
โ
Did I handle potential failure modes and edge cases?
|
|
68
|
+
โ
Have I avoided generic boilerplate that doesn't add value?
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### ๐ Verification-Before-Completion (VBC) Protocol
|
|
72
|
+
|
|
73
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
74
|
+
- โ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
75
|
+
- โ
**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.
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
# โโโ Detection โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
79
|
+
|
|
80
|
+
TRIBUNAL_MARKERS = [
|
|
81
|
+
"Tribunal Integration",
|
|
82
|
+
"Tribunal Integration (Anti-Hallucination)",
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
VBC_MARKERS = [
|
|
86
|
+
"Verification-Before-Completion",
|
|
87
|
+
"VBC Protocol",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def has_tribunal_block(content: str) -> bool:
|
|
92
|
+
return any(marker in content for marker in TRIBUNAL_MARKERS)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def has_vbc_block(content: str) -> bool:
|
|
96
|
+
return any(marker in content for marker in VBC_MARKERS)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# โโโ Output helpers โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
100
|
+
|
|
101
|
+
def header(title: str) -> None:
|
|
102
|
+
print(f"\n{BOLD}{BLUE}โโโ {title} โโโ{RESET}")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def ok(msg: str) -> None:
|
|
106
|
+
print(f" {GREEN}โ
{msg}{RESET}")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def skip(msg: str) -> None:
|
|
110
|
+
print(f" {YELLOW}โญ๏ธ {msg}{RESET}")
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def warn(msg: str) -> None:
|
|
114
|
+
print(f" {YELLOW}โ ๏ธ {msg}{RESET}")
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def fail(msg: str) -> None:
|
|
118
|
+
print(f" {RED}โ {msg}{RESET}")
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# โโโ Core โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
122
|
+
|
|
123
|
+
def process_skill(skill_md: Path, dry_run: bool) -> str:
|
|
124
|
+
"""Process a single SKILL.md. Returns 'updated', 'skipped', or 'error'."""
|
|
125
|
+
skill_name = skill_md.parent.name
|
|
126
|
+
try:
|
|
127
|
+
content = skill_md.read_text(encoding="utf-8")
|
|
128
|
+
|
|
129
|
+
has_tribunal = has_tribunal_block(content)
|
|
130
|
+
has_vbc = has_vbc_block(content)
|
|
131
|
+
|
|
132
|
+
if has_tribunal and has_vbc:
|
|
133
|
+
skip(f"{skill_name} โ already has Tribunal + VBC blocks")
|
|
134
|
+
return "skipped"
|
|
135
|
+
|
|
136
|
+
missing = []
|
|
137
|
+
if not has_tribunal:
|
|
138
|
+
missing.append("Tribunal Integration")
|
|
139
|
+
if not has_vbc:
|
|
140
|
+
missing.append("VBC Protocol")
|
|
141
|
+
|
|
142
|
+
if dry_run:
|
|
143
|
+
warn(f"[DRY RUN] {skill_name} โ would add: {', '.join(missing)}")
|
|
144
|
+
return "updated"
|
|
145
|
+
|
|
146
|
+
with skill_md.open("a", encoding="utf-8") as f:
|
|
147
|
+
f.write(GUARDRAILS_BLOCK)
|
|
148
|
+
|
|
149
|
+
ok(f"{skill_name} โ strengthened ({', '.join(missing)} added)")
|
|
150
|
+
return "updated"
|
|
151
|
+
|
|
152
|
+
except Exception as e:
|
|
153
|
+
fail(f"{skill_name} โ {e}")
|
|
154
|
+
return "error"
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
# โโโ Main โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
158
|
+
|
|
159
|
+
def main() -> None:
|
|
160
|
+
parser = argparse.ArgumentParser(
|
|
161
|
+
description="Appends Tribunal guardrails (LLM Traps + Pre-Flight + VBC) to skills missing them"
|
|
162
|
+
)
|
|
163
|
+
parser.add_argument(
|
|
164
|
+
"path",
|
|
165
|
+
nargs="?",
|
|
166
|
+
default=".",
|
|
167
|
+
help="Project root directory (default: current directory)"
|
|
168
|
+
)
|
|
169
|
+
parser.add_argument("--dry-run", action="store_true", help="Show changes without writing")
|
|
170
|
+
parser.add_argument("--skill", help="Only strengthen a specific skill by name")
|
|
171
|
+
parser.add_argument(
|
|
172
|
+
"--skills-path",
|
|
173
|
+
help="Override the skills directory path (default: <path>/.agent/skills)"
|
|
174
|
+
)
|
|
175
|
+
args = parser.parse_args()
|
|
176
|
+
|
|
177
|
+
project_root = Path(args.path).resolve()
|
|
178
|
+
skills_dir = (
|
|
179
|
+
Path(args.skills_path).resolve()
|
|
180
|
+
if args.skills_path
|
|
181
|
+
else project_root / ".agent" / "skills"
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
if not skills_dir.is_dir():
|
|
185
|
+
fail(f"Skills directory not found: {skills_dir}")
|
|
186
|
+
sys.exit(1)
|
|
187
|
+
|
|
188
|
+
print(f"{BOLD}Tribunal โ strengthen_skills.py{RESET}")
|
|
189
|
+
if args.dry_run:
|
|
190
|
+
print(f" {YELLOW}DRY RUN โ no files will be written{RESET}")
|
|
191
|
+
print(f"Skills dir: {skills_dir}\n")
|
|
192
|
+
|
|
193
|
+
counts: dict[str, int] = {"updated": 0, "skipped": 0, "error": 0}
|
|
194
|
+
|
|
195
|
+
header("Strengthening Skills")
|
|
196
|
+
for skill_dir in sorted(skills_dir.iterdir()):
|
|
197
|
+
if not skill_dir.is_dir():
|
|
198
|
+
continue
|
|
199
|
+
if args.skill and skill_dir.name != args.skill:
|
|
200
|
+
continue
|
|
201
|
+
skill_md = skill_dir / "SKILL.md"
|
|
202
|
+
if not skill_md.exists():
|
|
203
|
+
warn(f"{skill_dir.name} โ no SKILL.md found")
|
|
204
|
+
continue
|
|
205
|
+
result = process_skill(skill_md, args.dry_run)
|
|
206
|
+
counts[result] += 1
|
|
207
|
+
|
|
208
|
+
print(f"\n{BOLD}โโโ Summary โโโ{RESET}")
|
|
209
|
+
print(f" {GREEN}โ
Strengthened: {counts['updated']}{RESET}")
|
|
210
|
+
print(f" {YELLOW}โญ๏ธ Skipped: {counts['skipped']}{RESET}")
|
|
211
|
+
if counts["error"]:
|
|
212
|
+
print(f" {RED}โ Errors: {counts['error']}{RESET}")
|
|
213
|
+
if args.dry_run:
|
|
214
|
+
print(f" {YELLOW}(dry-run โ nothing written){RESET}")
|
|
215
|
+
|
|
216
|
+
sys.exit(1 if counts["error"] > 0 else 0)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
if __name__ == "__main__":
|
|
220
|
+
main()
|
|
@@ -72,7 +72,17 @@ def validate_payload(payload_data: dict, workspace_root: Path, agents_dir: Path)
|
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
def build_worker_prompts(payload_data: dict, workspace_root: Path) -> list:
|
|
75
|
+
import subprocess
|
|
75
76
|
prompts = []
|
|
77
|
+
|
|
78
|
+
ast_context = ""
|
|
79
|
+
try:
|
|
80
|
+
res = subprocess.run(["python", "-m", "code_review_graph", "review-delta"], cwd=workspace_root, capture_output=True, text=True)
|
|
81
|
+
if res.returncode == 0 and res.stdout.strip():
|
|
82
|
+
ast_context = "\n\n[AST Blast Radius Context]:\n" + res.stdout.strip()
|
|
83
|
+
except Exception as e:
|
|
84
|
+
logging.warning(f"code-review-graph failed: {e}")
|
|
85
|
+
|
|
76
86
|
workers = payload_data.get("dispatch_micro_workers", [])
|
|
77
87
|
for worker in workers:
|
|
78
88
|
agent = worker.get("target_agent")
|
|
@@ -82,7 +92,7 @@ def build_worker_prompts(payload_data: dict, workspace_root: Path) -> list:
|
|
|
82
92
|
|
|
83
93
|
prompt = f"--- MICRO-WORKER DISPATCH ---\n"
|
|
84
94
|
prompt += f"Agent: {agent}\n"
|
|
85
|
-
prompt += f"Context: {ctx}\n"
|
|
95
|
+
prompt += f"Context: {ctx}{ast_context}\n"
|
|
86
96
|
prompt += f"Task: {task}\n"
|
|
87
97
|
prompt += f"Attached Files: {', '.join(files) if files else 'None'}\n"
|
|
88
98
|
prompt += "-----------------------------"
|
|
@@ -298,7 +308,30 @@ def main():
|
|
|
298
308
|
if not validate_swarm_payload(payload_data, agents_dir):
|
|
299
309
|
logging.error("Swarm payload validation failed.")
|
|
300
310
|
sys.exit(1)
|
|
311
|
+
|
|
312
|
+
import subprocess
|
|
313
|
+
ast_context = ""
|
|
314
|
+
try:
|
|
315
|
+
res = subprocess.run(["python", "-m", "code_review_graph", "review-delta"], cwd=workspace_root, capture_output=True, text=True)
|
|
316
|
+
if res.returncode == 0 and res.stdout.strip():
|
|
317
|
+
ast_context = "\n\n[AST Blast Radius Context]:\n" + res.stdout.strip()
|
|
318
|
+
except Exception as e:
|
|
319
|
+
logging.warning(f"code-review-graph hook failed: {e}")
|
|
320
|
+
|
|
321
|
+
if ast_context:
|
|
322
|
+
items = payload_data.get("workers", payload_data) if isinstance(payload_data, dict) else payload_data
|
|
323
|
+
if isinstance(items, list):
|
|
324
|
+
for item in items:
|
|
325
|
+
if "context" in item:
|
|
326
|
+
item["context"] += ast_context
|
|
327
|
+
elif isinstance(items, dict) and "context" in items:
|
|
328
|
+
items["context"] += ast_context
|
|
329
|
+
|
|
301
330
|
logging.info("Swarm payload validation successful.")
|
|
331
|
+
# Re-emit the enriched payload for downstream
|
|
332
|
+
if ast_context:
|
|
333
|
+
print("--- ENRICHED SWARM PAYLOAD ---")
|
|
334
|
+
print(json.dumps(payload_data, indent=2))
|
|
302
335
|
else:
|
|
303
336
|
# Legacy mode
|
|
304
337
|
if not validate_payload(payload_data, workspace_root, agents_dir):
|
|
@@ -26,6 +26,23 @@ applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
+
## Skill Pattern Inheritance
|
|
30
|
+
|
|
31
|
+
The Tribunal Agent Kit supports 5 standard Agent Design Kit (ADK) base patterns.
|
|
32
|
+
To build a skill using a robust, tested agent behavior model, add `pattern: [pattern-name]` to the YAML frontmatter of your `SKILL.md`.
|
|
33
|
+
|
|
34
|
+
| Pattern | Value | When to use |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| **Inversion** | `pattern: inversion` | Forces the agent to interview the user (Socratic Gate) before acting. |
|
|
37
|
+
| **Reviewer** | `pattern: reviewer` | Evaluates artifacts against a checklist and severity levels. |
|
|
38
|
+
| **Tool Wrapper** | `pattern: tool-wrapper` | Strictly executes external CLI tools via provided documentation without guessing. |
|
|
39
|
+
| **Generator** | `pattern: generator` | Produces structured output (docs, boilerplate) by filling a rigid template. |
|
|
40
|
+
| **Pipeline** | `pattern: pipeline` | Executes sequential tasks with strict halting gates between steps. |
|
|
41
|
+
|
|
42
|
+
*Templates defining the specific rules for these patterns live in `.agent/patterns/`.*
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
29
46
|
## README Template
|
|
30
47
|
|
|
31
48
|
```markdown
|