analyzthis_design 2.0.1 → 2.1.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/README.md +10 -5
- package/agents/cards/evolve-check.md +38 -0
- package/agents/manifests/evolve-check.json +16 -0
- package/dist/README.md +10 -5
- package/dist/agents/cards/evolve-check.md +38 -0
- package/dist/agents/manifests/evolve-check.json +16 -0
- package/dist/bin/cli.js +1225 -1
- package/dist/lib/cache.js +111 -1
- package/dist/lib/chunk-executor.js +219 -1
- package/dist/lib/chunk-models.js +228 -1
- package/dist/lib/chunk-planner.js +328 -1
- package/dist/lib/chunk-router.js +66 -1
- package/dist/lib/chunk-run.js +199 -1
- package/dist/lib/chunk-synthesis.js +176 -1
- package/dist/lib/chunk-telemetry.js +88 -1
- package/dist/lib/collect.js +858 -1
- package/dist/lib/cost.js +119 -1
- package/dist/lib/dedup.js +167 -1
- package/dist/lib/deliberation.js +721 -1
- package/dist/lib/design-spec.js +236 -1
- package/dist/lib/evolution-metrics.js +197 -0
- package/dist/lib/evolve.js +361 -1
- package/dist/lib/export.js +77 -1
- package/dist/lib/feedback-submit.js +324 -1
- package/dist/lib/feedback.js +182 -1
- package/dist/lib/host-llm.js +251 -1
- package/dist/lib/install.js +301 -1
- package/dist/lib/knowledge.js +384 -1
- package/dist/lib/lessons.js +217 -1
- package/dist/lib/moodboard.js +563 -1
- package/dist/lib/orchestrator/run.js +935 -1
- package/dist/lib/outcome.js +193 -1
- package/dist/lib/platforms.js +166 -1
- package/dist/lib/provider.js +57 -1
- package/dist/lib/query-expander.js +83 -1
- package/dist/lib/ranker.js +105 -1
- package/dist/lib/reference-pack.js +221 -1
- package/dist/lib/research.js +143 -1
- package/dist/lib/retrieve.js +131 -1
- package/dist/lib/session.js +185 -1
- package/dist/lib/source-discovery.js +486 -1
- package/dist/lib/synthesis.js +155 -1
- package/dist/lib/token-gate.js +46 -1
- package/dist/skills/evolve-check/SKILL.md +106 -0
- package/package.json +3 -6
- package/skills/evolve-check/SKILL.md +106 -0
package/dist/lib/token-gate.js
CHANGED
|
@@ -1 +1,46 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Output token / size enforcement for persona + host (Devi) responses.
|
|
5
|
+
* ~4 chars per token (estimate). Preserves deliberation JSON fence when truncating.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const CHARS_PER_TOKEN = 4;
|
|
9
|
+
|
|
10
|
+
function maxCharsForTokens(maxTokens) {
|
|
11
|
+
return Math.max(200, Math.floor(Number(maxTokens) * CHARS_PER_TOKEN));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Truncate persona output to max token budget. Keeps ```json deliberation block intact.
|
|
16
|
+
*/
|
|
17
|
+
function enforceOutputCap(text, maxTokens) {
|
|
18
|
+
if (!text || maxTokens == null) return text || '';
|
|
19
|
+
const maxChars = maxCharsForTokens(maxTokens);
|
|
20
|
+
if (text.length <= maxChars) return text;
|
|
21
|
+
|
|
22
|
+
const fenceRe = /```json\s*deliberation\s*[\s\S]*?```/i;
|
|
23
|
+
const fenceMatch = text.match(fenceRe);
|
|
24
|
+
if (fenceMatch) {
|
|
25
|
+
const fence = fenceMatch[0];
|
|
26
|
+
const fenceStart = text.indexOf(fence);
|
|
27
|
+
const body = text.slice(0, fenceStart).trim();
|
|
28
|
+
const bodyBudget = maxChars - fence.length - 16;
|
|
29
|
+
if (bodyBudget > 80) {
|
|
30
|
+
return `${body.slice(0, bodyBudget)}\n…\n${fence}`;
|
|
31
|
+
}
|
|
32
|
+
return fence;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return `${text.slice(0, maxChars - 20)}\n… [output capped at ~${maxTokens} tokens]`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Trim system prompt on objection rounds — cards only, hard ceiling.
|
|
40
|
+
*/
|
|
41
|
+
function enforceSystemCap(system, maxChars = 5500) {
|
|
42
|
+
if (!system || system.length <= maxChars) return system;
|
|
43
|
+
return `${system.slice(0, maxChars - 24)}\n… [system prompt capped]`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = { enforceOutputCap, enforceSystemCap, maxCharsForTokens, CHARS_PER_TOKEN };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: evolve-check
|
|
3
|
+
description: Devi skill — after a successful critique run, check if personas have enough data to evolve and offer to run the evolution cycle. Shows evolution metrics dashboard.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Evolve Check
|
|
8
|
+
|
|
9
|
+
After a successful critique run, Devi checks if the team has accumulated enough lessons and outcomes to propose evolution patches (prompt edits, CSV reference rows, router changes).
|
|
10
|
+
|
|
11
|
+
## When to invoke
|
|
12
|
+
|
|
13
|
+
Invoke this skill **after** a completed `run` or `run-unchunked` where:
|
|
14
|
+
- Personas produced outputs
|
|
15
|
+
- User accepted at least one output (`session accept --persona X`)
|
|
16
|
+
- Ideally, user confirmed an outcome (`outcome --confirm --persona X --result shipped`)
|
|
17
|
+
|
|
18
|
+
## What to do
|
|
19
|
+
|
|
20
|
+
### Step 1 — Check readiness
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx analyzthis_design evolve --ready --project <projectId>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This prints:
|
|
27
|
+
- Whether evolution is ready (enough lessons/outcomes)
|
|
28
|
+
- The team evolution dashboard with per-persona scores
|
|
29
|
+
|
|
30
|
+
### Step 2 — If ready, extract patches
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx analyzthis_design evolve --extract --dry-run
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This proposes:
|
|
37
|
+
- **Prompt patches** — new canonical failure patterns added to persona SKILL.md
|
|
38
|
+
- **Reference rows** — new CSV rows learned from accepted outputs
|
|
39
|
+
- **Router patches** — routing changes based on outcome data
|
|
40
|
+
|
|
41
|
+
### Step 3 — Ask the user
|
|
42
|
+
|
|
43
|
+
Present the proposed patches and ask:
|
|
44
|
+
|
|
45
|
+
> The team has accumulated enough data to evolve. I found:
|
|
46
|
+
> - **2 prompt patches** (Arjun, Meera)
|
|
47
|
+
> - **1 reference row** (Zara — new color palette pattern)
|
|
48
|
+
> - **1 router patch** (full_screen_review → Arjun)
|
|
49
|
+
>
|
|
50
|
+
> Would you like me to apply any of these? I'll show a dry-run preview first.
|
|
51
|
+
|
|
52
|
+
### Step 4 — If user says yes
|
|
53
|
+
|
|
54
|
+
For each patch the user wants to apply:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx analyzthis_design evolve --apply <patchId> --dry-run # preview first
|
|
58
|
+
npx analyzthis_design evolve --apply <patchId> # apply for real
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Router patches require manual review — point the user to `agents/router.json`.
|
|
62
|
+
|
|
63
|
+
### Step 5 — If not ready
|
|
64
|
+
|
|
65
|
+
Tell the user what's needed:
|
|
66
|
+
|
|
67
|
+
> Not enough data yet. The team has **2/5 lessons** and **0/10 outcomes**.
|
|
68
|
+
> To trigger evolution:
|
|
69
|
+
> 1. Run more critiques: `npx analyzthis_design run --task "..."`
|
|
70
|
+
> 2. Accept good outputs: `npx analyzthis_design session accept --persona arjun`
|
|
71
|
+
> 3. Confirm outcomes: `npx analyzthis_design outcome --confirm --persona arjun --result shipped`
|
|
72
|
+
|
|
73
|
+
## Evolution metrics
|
|
74
|
+
|
|
75
|
+
The dashboard shows per-persona evolution scores (0-100):
|
|
76
|
+
|
|
77
|
+
| Score | Level | Meaning |
|
|
78
|
+
|-------|-------|---------|
|
|
79
|
+
| 0-19 | Novice | No data yet |
|
|
80
|
+
| 20-39 | Developing | Some lessons extracted |
|
|
81
|
+
| 40-59 | Proficient | Lessons + outcomes accumulating |
|
|
82
|
+
| 60-79 | Advanced | Patches proposed and some applied |
|
|
83
|
+
| 80-100 | Expert | Significant evolution, patches applied |
|
|
84
|
+
|
|
85
|
+
Scoring:
|
|
86
|
+
- 10 pts per lesson (cap 100)
|
|
87
|
+
- 15 pts per confirmed outcome (cap 100)
|
|
88
|
+
- 20 pts per proposed patch (cap 100)
|
|
89
|
+
- 25 pts bonus per applied patch
|
|
90
|
+
|
|
91
|
+
## CLI reference
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Check readiness + dashboard
|
|
95
|
+
npx analyzthis_design evolve --ready
|
|
96
|
+
|
|
97
|
+
# Just the dashboard
|
|
98
|
+
npx analyzthis_design evolve --metrics
|
|
99
|
+
|
|
100
|
+
# Extract patches (dry-run by default)
|
|
101
|
+
npx analyzthis_design evolve --extract --dry-run
|
|
102
|
+
|
|
103
|
+
# Apply a patch
|
|
104
|
+
npx analyzthis_design evolve --apply <patchId> --dry-run
|
|
105
|
+
npx analyzthis_design evolve --apply <patchId>
|
|
106
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "analyzthis_design",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"description": "8 AI design personas — v2.0 chunked execution with frontier planner + free/cheap chunk models, adversarial deliberation loops, opt-in community feedback, Kavi knowledge collection, DesignSpec producer path, wireframe skills, UX critique, Agent Skills for Cursor, Claude, Codex, Grok, Windsurf.",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "8 AI design personas — v2.0 chunked execution with frontier planner + free/cheap chunk models, adversarial deliberation loops, opt-in community feedback, Kavi knowledge collection, DesignSpec producer path, wireframe skills, UX critique, Agent Skills for Cursor, Claude, Codex, Grok, Windsurf. Plain source — no obfuscation, no auto-install.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cursor",
|
|
7
7
|
"cursor-skill",
|
|
@@ -43,12 +43,9 @@
|
|
|
43
43
|
"build": "node scripts/obfuscate.js",
|
|
44
44
|
"validate": "node scripts/validate-csvs.js",
|
|
45
45
|
"prepublishOnly": "npm run build && npm run validate",
|
|
46
|
-
"postinstall": "node
|
|
46
|
+
"postinstall": "node -e \"console.log('\\n analyzthis_design installed. Run: npx analyzthis_design --target all\\n Or: npx analyzthis_design welcome\\n')\""
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=16"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"javascript-obfuscator": "^5.4.7"
|
|
53
50
|
}
|
|
54
51
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: evolve-check
|
|
3
|
+
description: Devi skill — after a successful critique run, check if personas have enough data to evolve and offer to run the evolution cycle. Shows evolution metrics dashboard.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Evolve Check
|
|
8
|
+
|
|
9
|
+
After a successful critique run, Devi checks if the team has accumulated enough lessons and outcomes to propose evolution patches (prompt edits, CSV reference rows, router changes).
|
|
10
|
+
|
|
11
|
+
## When to invoke
|
|
12
|
+
|
|
13
|
+
Invoke this skill **after** a completed `run` or `run-unchunked` where:
|
|
14
|
+
- Personas produced outputs
|
|
15
|
+
- User accepted at least one output (`session accept --persona X`)
|
|
16
|
+
- Ideally, user confirmed an outcome (`outcome --confirm --persona X --result shipped`)
|
|
17
|
+
|
|
18
|
+
## What to do
|
|
19
|
+
|
|
20
|
+
### Step 1 — Check readiness
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx analyzthis_design evolve --ready --project <projectId>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This prints:
|
|
27
|
+
- Whether evolution is ready (enough lessons/outcomes)
|
|
28
|
+
- The team evolution dashboard with per-persona scores
|
|
29
|
+
|
|
30
|
+
### Step 2 — If ready, extract patches
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx analyzthis_design evolve --extract --dry-run
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This proposes:
|
|
37
|
+
- **Prompt patches** — new canonical failure patterns added to persona SKILL.md
|
|
38
|
+
- **Reference rows** — new CSV rows learned from accepted outputs
|
|
39
|
+
- **Router patches** — routing changes based on outcome data
|
|
40
|
+
|
|
41
|
+
### Step 3 — Ask the user
|
|
42
|
+
|
|
43
|
+
Present the proposed patches and ask:
|
|
44
|
+
|
|
45
|
+
> The team has accumulated enough data to evolve. I found:
|
|
46
|
+
> - **2 prompt patches** (Arjun, Meera)
|
|
47
|
+
> - **1 reference row** (Zara — new color palette pattern)
|
|
48
|
+
> - **1 router patch** (full_screen_review → Arjun)
|
|
49
|
+
>
|
|
50
|
+
> Would you like me to apply any of these? I'll show a dry-run preview first.
|
|
51
|
+
|
|
52
|
+
### Step 4 — If user says yes
|
|
53
|
+
|
|
54
|
+
For each patch the user wants to apply:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx analyzthis_design evolve --apply <patchId> --dry-run # preview first
|
|
58
|
+
npx analyzthis_design evolve --apply <patchId> # apply for real
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Router patches require manual review — point the user to `agents/router.json`.
|
|
62
|
+
|
|
63
|
+
### Step 5 — If not ready
|
|
64
|
+
|
|
65
|
+
Tell the user what's needed:
|
|
66
|
+
|
|
67
|
+
> Not enough data yet. The team has **2/5 lessons** and **0/10 outcomes**.
|
|
68
|
+
> To trigger evolution:
|
|
69
|
+
> 1. Run more critiques: `npx analyzthis_design run --task "..."`
|
|
70
|
+
> 2. Accept good outputs: `npx analyzthis_design session accept --persona arjun`
|
|
71
|
+
> 3. Confirm outcomes: `npx analyzthis_design outcome --confirm --persona arjun --result shipped`
|
|
72
|
+
|
|
73
|
+
## Evolution metrics
|
|
74
|
+
|
|
75
|
+
The dashboard shows per-persona evolution scores (0-100):
|
|
76
|
+
|
|
77
|
+
| Score | Level | Meaning |
|
|
78
|
+
|-------|-------|---------|
|
|
79
|
+
| 0-19 | Novice | No data yet |
|
|
80
|
+
| 20-39 | Developing | Some lessons extracted |
|
|
81
|
+
| 40-59 | Proficient | Lessons + outcomes accumulating |
|
|
82
|
+
| 60-79 | Advanced | Patches proposed and some applied |
|
|
83
|
+
| 80-100 | Expert | Significant evolution, patches applied |
|
|
84
|
+
|
|
85
|
+
Scoring:
|
|
86
|
+
- 10 pts per lesson (cap 100)
|
|
87
|
+
- 15 pts per confirmed outcome (cap 100)
|
|
88
|
+
- 20 pts per proposed patch (cap 100)
|
|
89
|
+
- 25 pts bonus per applied patch
|
|
90
|
+
|
|
91
|
+
## CLI reference
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Check readiness + dashboard
|
|
95
|
+
npx analyzthis_design evolve --ready
|
|
96
|
+
|
|
97
|
+
# Just the dashboard
|
|
98
|
+
npx analyzthis_design evolve --metrics
|
|
99
|
+
|
|
100
|
+
# Extract patches (dry-run by default)
|
|
101
|
+
npx analyzthis_design evolve --extract --dry-run
|
|
102
|
+
|
|
103
|
+
# Apply a patch
|
|
104
|
+
npx analyzthis_design evolve --apply <patchId> --dry-run
|
|
105
|
+
npx analyzthis_design evolve --apply <patchId>
|
|
106
|
+
```
|