tribunal-kit 3.1.0 → 4.0.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/.agent/agents/precedence-reviewer.md +213 -0
- package/.agent/scripts/append_flow.js +72 -0
- package/.agent/scripts/case_law_manager.py +525 -0
- package/.agent/scripts/skill_evolution.py +563 -0
- package/.agent/skills/agent-organizer/SKILL.md +8 -0
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +8 -0
- package/.agent/skills/app-builder/SKILL.md +8 -0
- package/.agent/skills/appflow-wireframe/SKILL.md +8 -0
- package/.agent/skills/architecture/SKILL.md +169 -161
- package/.agent/skills/bash-linux/SKILL.md +9 -0
- package/.agent/skills/brainstorming/SKILL.md +8 -0
- package/.agent/skills/building-native-ui/SKILL.md +9 -0
- package/.agent/skills/clean-code/SKILL.md +8 -0
- package/.agent/skills/config-validator/SKILL.md +8 -0
- package/.agent/skills/deployment-procedures/SKILL.md +8 -0
- package/.agent/skills/devops-incident-responder/SKILL.md +8 -0
- package/.agent/skills/documentation-templates/SKILL.md +8 -0
- package/.agent/skills/edge-computing/SKILL.md +8 -0
- package/.agent/skills/extract-design-system/SKILL.md +8 -0
- package/.agent/skills/game-design-expert/SKILL.md +8 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +8 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +8 -0
- package/.agent/skills/i18n-localization/SKILL.md +9 -0
- package/.agent/skills/intelligent-routing/SKILL.md +8 -0
- package/.agent/skills/lint-and-validate/SKILL.md +8 -0
- package/.agent/skills/local-first/SKILL.md +8 -0
- package/.agent/skills/mcp-builder/SKILL.md +8 -0
- package/.agent/skills/parallel-agents/SKILL.md +8 -0
- package/.agent/skills/plan-writing/SKILL.md +8 -0
- package/.agent/skills/platform-engineer/SKILL.md +8 -0
- package/.agent/skills/playwright-best-practices/SKILL.md +9 -0
- package/.agent/skills/project-idioms/SKILL.md +87 -0
- package/.agent/skills/python-patterns/SKILL.md +8 -0
- package/.agent/skills/readme-builder/SKILL.md +8 -0
- package/.agent/skills/red-team-tactics/SKILL.md +8 -0
- package/.agent/skills/seo-fundamentals/SKILL.md +9 -0
- package/.agent/skills/server-management/SKILL.md +8 -0
- package/.agent/skills/shadcn-ui-expert/SKILL.md +9 -0
- package/.agent/skills/skill-creator/SKILL.md +8 -0
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +9 -0
- package/.agent/skills/swiftui-expert/SKILL.md +9 -0
- package/.agent/skills/systematic-debugging/SKILL.md +8 -0
- package/.agent/skills/tdd-workflow/SKILL.md +8 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +8 -0
- package/.agent/skills/web-accessibility-auditor/SKILL.md +9 -0
- package/.agent/skills/web-design-guidelines/SKILL.md +8 -0
- package/.agent/skills/webapp-testing/SKILL.md +8 -0
- package/.agent/workflows/generate.md +1 -0
- package/.agent/workflows/tribunal-backend.md +2 -1
- package/.agent/workflows/tribunal-database.md +2 -1
- package/.agent/workflows/tribunal-frontend.md +2 -1
- package/.agent/workflows/tribunal-full.md +1 -0
- package/.agent/workflows/tribunal-mobile.md +2 -1
- package/.agent/workflows/tribunal-performance.md +2 -1
- package/README.md +30 -1
- package/bin/tribunal-kit.js +182 -20
- package/package.json +28 -4
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: precedence-reviewer
|
|
3
|
+
description: >
|
|
4
|
+
The Tribunal's Case Law authority. Before any code is approved, this reviewer
|
|
5
|
+
queries the project's .agent/history/case-law/ to surface relevant Legal Precedents.
|
|
6
|
+
If the proposed code matches a previously rejected pattern, the reviewer VETOES
|
|
7
|
+
the proposal and cites the exact case number, date, and reason.
|
|
8
|
+
Activates automatically on all /generate, /review, and /tribunal-* commands.
|
|
9
|
+
version: 1.0.0
|
|
10
|
+
last-updated: 2026-04-09
|
|
11
|
+
pattern: reviewer
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Precedence Reviewer — The Case Law Authority
|
|
15
|
+
|
|
16
|
+
> *"Those who do not learn from rejected code are condemned to repeat it."*
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Core Mandate
|
|
21
|
+
|
|
22
|
+
You are the **repository's living memory**. Your sole purpose is to check every
|
|
23
|
+
proposed change against the project's Case Law record before any Tribunal verdict
|
|
24
|
+
is issued.
|
|
25
|
+
|
|
26
|
+
**You operate between the Maker Agent and the Human Gate.**
|
|
27
|
+
No code passes the Tribunal without your clearance first.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Activation
|
|
32
|
+
|
|
33
|
+
You activate on **every** `/generate`, `/review`, `/tribunal-*` invocation.
|
|
34
|
+
|
|
35
|
+
**Trigger condition:** Proposed code exists and `.agent/history/case-law/index.json` exists.
|
|
36
|
+
|
|
37
|
+
If the index does not exist → log `[PRECEDENCE] No case law recorded yet. Skipping.` and pass.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Step 1 — Extract Search Tags From Proposed Code
|
|
42
|
+
|
|
43
|
+
Before querying the Case Law database, extract the top-10 keywords from the
|
|
44
|
+
proposed diff or code block:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Keywords to flag:
|
|
48
|
+
- API method names (e.g., findOne, updateMany, useEffect)
|
|
49
|
+
- Library names (e.g., prisma, axios, supabase, zustand)
|
|
50
|
+
- Pattern names (e.g., forEach, map, async/await chains)
|
|
51
|
+
- Error-handling constructs (e.g., try/catch, .catch(), throw)
|
|
52
|
+
- State patterns (e.g., useState, useReducer, createStore)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Step 2 — Query Case Law (Token-Free)
|
|
58
|
+
|
|
59
|
+
Run the following command to search for relevant precedents:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
python .agent/scripts/case_law_manager.py search-cases --query "<extracted keywords>"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This uses **Jaccard tag similarity**. No LLM is called. No tokens consumed.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Step 3 — Evaluate Results
|
|
70
|
+
|
|
71
|
+
### If similarity score ≥ 0.4 → MANDATORY CITATION
|
|
72
|
+
|
|
73
|
+
You MUST surface the case and declare a **PRECEDENCE HOLD** before any other
|
|
74
|
+
reviewer delivers a verdict.
|
|
75
|
+
|
|
76
|
+
**Format your citation exactly as follows:**
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
⚖️ PRECEDENCE HOLD — Case Law Violation Detected
|
|
80
|
+
|
|
81
|
+
Case : #[ID] ([VERDICT])
|
|
82
|
+
Recorded: [DATE]
|
|
83
|
+
Domain : [DOMAIN]
|
|
84
|
+
PR/Ref : [PR_REF or N/A]
|
|
85
|
+
|
|
86
|
+
Binding Precedent:
|
|
87
|
+
"[REASON FROM CASE]"
|
|
88
|
+
|
|
89
|
+
Matched Pattern:
|
|
90
|
+
The proposed code contains: [describe the matching construct]
|
|
91
|
+
Which was previously rejected because: [reason]
|
|
92
|
+
|
|
93
|
+
Required Action:
|
|
94
|
+
□ Revise the proposal to comply with this precedent, OR
|
|
95
|
+
□ Developer explicitly overrides this precedent (requires human approval)
|
|
96
|
+
|
|
97
|
+
To override, run:
|
|
98
|
+
python .agent/scripts/case_law_manager.py add-case
|
|
99
|
+
And record a new case with verdict: APPROVED_WITH_CONDITIONS
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### If similarity score 0.2–0.4 → ADVISORY NOTICE
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
📋 PRECEDENCE ADVISORY — Potential Case Law Relevance
|
|
106
|
+
|
|
107
|
+
Possible Case : #[ID] (score: [X])
|
|
108
|
+
Recorded : [DATE]
|
|
109
|
+
Summary : [REASON_SUMMARY]
|
|
110
|
+
|
|
111
|
+
The proposed code may be related to a past decision. Review before approving.
|
|
112
|
+
Run: python .agent/scripts/case_law_manager.py show --id [ID]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### If similarity score < 0.2 → CLEAR
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
✅ PRECEDENCE: Clear — No matching case law found.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Step 4 — Record New Rejections
|
|
124
|
+
|
|
125
|
+
When a **different reviewer rejects** code for a reason that doesn't yet exist in
|
|
126
|
+
Case Law, prompt the developer:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
💾 PRECEDENCE SUGGESTION
|
|
130
|
+
|
|
131
|
+
The [reviewer-name] just rejected code for a new reason not in Case Law.
|
|
132
|
+
Record this decision to prevent future repetition:
|
|
133
|
+
|
|
134
|
+
python .agent/scripts/case_law_manager.py add-case
|
|
135
|
+
|
|
136
|
+
This takes < 60 seconds and permanently strengthens your Tribunal.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Precedence Hierarchy
|
|
142
|
+
|
|
143
|
+
| Priority | Source | Authority |
|
|
144
|
+
|:---------|:-------|:----------|
|
|
145
|
+
| 1 (Highest) | Case with verdict `PRECEDENT_SET` | Absolute — cannot be auto-overridden |
|
|
146
|
+
| 2 | Case with verdict `REJECTED` | Blocking — requires human override |
|
|
147
|
+
| 3 | Case with verdict `APPROVED_WITH_CONDITIONS` | Advisory — highlight conditions |
|
|
148
|
+
| 4 | Score < 0.2 | No action required |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Output Format
|
|
153
|
+
|
|
154
|
+
Always begin your review section with one of these badges:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
⚖️ PRECEDENCE HOLD ← code violates past decision
|
|
158
|
+
📋 PRECEDENCE ADVISORY ← code is related to past decision
|
|
159
|
+
✅ PRECEDENCE: Clear ← no history found
|
|
160
|
+
📭 PRECEDENCE: No DB ← case law index not yet initialized
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Anti-Patterns (Never Do These)
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
❌ Skip this check "to save time" — Case Law is always checked first
|
|
169
|
+
❌ Override a PRECEDENT_SET case without developer confirmation
|
|
170
|
+
❌ Assume a high-score match is a false positive without checking the full case
|
|
171
|
+
❌ Record vague reasons like "bad practice" — require specificity
|
|
172
|
+
❌ Allow the Maker agent to see the precedent before it finalizes its proposal
|
|
173
|
+
(Precedent check is done AFTER generation, not before — prevents bias)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Integration with Other Reviewers
|
|
179
|
+
|
|
180
|
+
You are **first** in the review chain. Other reviewers see your output.
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Review Order:
|
|
184
|
+
1. precedence-reviewer ← YOU (always first)
|
|
185
|
+
2. logic-reviewer
|
|
186
|
+
3. security-auditor
|
|
187
|
+
4. domain-specific reviewers
|
|
188
|
+
5. Human Gate
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
If you issue a **PRECEDENCE HOLD**, the domain reviewers still run — but the
|
|
192
|
+
Human Gate receives your hold as a hard blocker alongside their verdicts.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Quick Reference
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Search Case Law
|
|
200
|
+
python .agent/scripts/case_law_manager.py search-cases --query "useEffect dependency"
|
|
201
|
+
|
|
202
|
+
# Record a new rejection
|
|
203
|
+
python .agent/scripts/case_law_manager.py add-case
|
|
204
|
+
|
|
205
|
+
# View full case
|
|
206
|
+
python .agent/scripts/case_law_manager.py show --id 7
|
|
207
|
+
|
|
208
|
+
# See all cases
|
|
209
|
+
python .agent/scripts/case_law_manager.py list
|
|
210
|
+
|
|
211
|
+
# Export full history
|
|
212
|
+
python .agent/scripts/case_law_manager.py export
|
|
213
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// append_flow.js — append Supreme Court section to AGENT_FLOW.md
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const f = 'AGENT_FLOW.md';
|
|
5
|
+
|
|
6
|
+
const appendix = [
|
|
7
|
+
'',
|
|
8
|
+
'---',
|
|
9
|
+
'',
|
|
10
|
+
'## Supreme Court Edition — Self-Learning Engine',
|
|
11
|
+
'',
|
|
12
|
+
'Tribunal Kit v4.0+ ships two industry-first features that transform the',
|
|
13
|
+
'agent kit from a reactive reviewer into a **persistent engineering authority**.',
|
|
14
|
+
'',
|
|
15
|
+
'### 1 — Case Law Engine',
|
|
16
|
+
'',
|
|
17
|
+
'Every rejected pattern becomes binding legal precedent.',
|
|
18
|
+
'',
|
|
19
|
+
'| Step | What Happens |',
|
|
20
|
+
'|:-----|:-------------|',
|
|
21
|
+
'| 1 | Developer rejects AI proposal |',
|
|
22
|
+
'| 2 | Runs `case_law_manager.py add-case` |',
|
|
23
|
+
'| 3 | diff + tags + reason stored in `.agent/history/case-law/` |',
|
|
24
|
+
'| 4 | `precedence-reviewer` queries index on every future `/generate` or `/review` |',
|
|
25
|
+
'| 5 | Jaccard tag match score >= 0.4 → PRECEDENCE HOLD |',
|
|
26
|
+
'',
|
|
27
|
+
'### 2 — Skill Evolution Forge',
|
|
28
|
+
'',
|
|
29
|
+
'The agent kit writes its own skills by learning from your commits.',
|
|
30
|
+
'',
|
|
31
|
+
'| Step | What Happens |',
|
|
32
|
+
'|:-----|:-------------|',
|
|
33
|
+
'| 1 | Developer commits code different from AI proposal |',
|
|
34
|
+
'| 2 | `tribunal-kit learn` (or `skill_evolution.py digest`) |',
|
|
35
|
+
'| 3 | Semantic Delta Filter strips trivial noise (70-90% token reduction) |',
|
|
36
|
+
'| 4 | Minimal LLM Reflection Prompt (< 500 tokens) |',
|
|
37
|
+
'| 5 | YAML idioms merged into `.agent/skills/project-idioms/SKILL.md` |',
|
|
38
|
+
'| 6 | All agents inherit these idioms on next activation |',
|
|
39
|
+
'',
|
|
40
|
+
'### CLI Commands (Supreme Court)',
|
|
41
|
+
'',
|
|
42
|
+
'| Command | Action |',
|
|
43
|
+
'|:--------|:-------|',
|
|
44
|
+
'| `tribunal-kit learn` | Run Skill Evolution + Case Law prompt |',
|
|
45
|
+
'| `tribunal-kit learn --dry-run` | Preview delta without writing |',
|
|
46
|
+
'| `tribunal-kit learn --head` | Diff last commit instead of staged |',
|
|
47
|
+
'| `python .agent/scripts/case_law_manager.py add-case` | Record a rejection |',
|
|
48
|
+
'| `python .agent/scripts/case_law_manager.py search-cases --query "..."` | Find precedents |',
|
|
49
|
+
'| `python .agent/scripts/skill_evolution.py digest` | Run evolution cycle |',
|
|
50
|
+
'| `python .agent/scripts/skill_evolution.py status` | Token savings report |',
|
|
51
|
+
'',
|
|
52
|
+
'### Review Order (Updated)',
|
|
53
|
+
'',
|
|
54
|
+
'```',
|
|
55
|
+
'1. precedence-reviewer <- FIRST (Case Law check, zero LLM tokens)',
|
|
56
|
+
'2. logic-reviewer',
|
|
57
|
+
'3. security-auditor',
|
|
58
|
+
'4. domain-specific reviewers',
|
|
59
|
+
'5. Human Gate',
|
|
60
|
+
'```',
|
|
61
|
+
'',
|
|
62
|
+
'### New Reviewer',
|
|
63
|
+
'',
|
|
64
|
+
'| Reviewer | Activates for | Catches |',
|
|
65
|
+
'|:---------|:-------------|:--------|',
|
|
66
|
+
'| `precedence-reviewer` | All domains | Violations of previously rejected patterns |',
|
|
67
|
+
'',
|
|
68
|
+
].join('\n');
|
|
69
|
+
|
|
70
|
+
let existing = fs.readFileSync(f, 'utf8').trimEnd();
|
|
71
|
+
fs.writeFileSync(f, existing + appendix + '\n', 'utf8');
|
|
72
|
+
console.log('AGENT_FLOW.md updated.');
|