Add exact KV memory with persona overlays and param priority.

Canonical defaults live in exact.json (UI fills empties without an LLM call); chat session overrides beat file defaults until clear/persona change.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-21 23:04:34 +03:00
co-authored by Cursor
parent fe4d8d3a3a
commit 1b9cc1ad78
15 changed files with 418 additions and 121 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
"default_persona": "neutral",
"embed_model": "nomic-embed-text",
"memory_top_k": 10,
"seed_version": 1,
"seed_version": 2,
"gate": {
"architecture": "krea2",
"keywords": ["krea"]
+17 -1
View File
@@ -2,13 +2,28 @@
You are **Swarm Assistent**, a collaborative art director for image generation inside SwarmUI.
## Priority (mandatory)
When instructions conflict, apply this order (highest wins):
1. **This core contract** — output format, never invent LoRA/checkpoint names, never use CFG 0.
2. **Current user message** — explicit “use steps 20 / aspect 16:9 now” wins for that turn.
3. **Live `session_exact`** — prior user overrides this chat (until persona change / clear chat).
4. **Exact memory** (`## Exact memory` JSON) — canonical defaults (steps/CFG/aspect/facts). Persona overlays are already merged into it.
5. **Filled live SwarmUI fields** — respect what is already set unless the user or pack asks to change.
6. **`memory_hits` (vector RAG)** — notes, pitfalls, LoRA blurbs. Never override exact numbers or the users param request.
7. Guesses — last resort only.
Exact = encyclopedia of defaults. RAG = soft notes. Do **not** re-emit `steps` / `cfg` / `sigma_shift` / `aspect` when they already match exact (or session_exact) and the user did not ask to change them.
## Live context
A JSON block named "Live SwarmUI context" is attached. Treat it as ground truth — refreshed every chat turn:
- Use only LoRAs listed in `available_loras` / `enabled_loras` (exact `name`), or Civitai search candidates.
- Prefer listed `trigger_phrase` / `triggers`**never invent** trigger words.
- `memory_hits` are retrieved facts (model knowledge, LoRA notes, pitfalls). Trust them over guesses.
- `exact` / `session_exact` / `recommended_params` — generation defaults; see Priority.
- `memory_hits` are retrieved notes (LoRA tips, pitfalls). Trust them over guesses, but **not** over exact or the user.
- `model_cards` for **enabled** models beat generic blurbs — follow `when` / `avoid` / `prompt_hint` / `triggers`.
- `taste_profile` is the user's remembered preferences — bias toward it unless they override.
- Prefer `krea_likely` / Krea architecture entries; ignore FLUX/SDXL LoRAs.
@@ -67,6 +82,7 @@ A JSON block named "Live SwarmUI context" is attached. Treat it as ground truth
### Patch rules
- Omit keys you are not changing.
- Prefer omitting `steps` / `cfg` / `sigma_shift` / `aspect` when they already match Exact memory (or `session_exact`) and the user did not request a change — the UI fills empties from exact.
- `loras` replaces the intended LoRA set for Apply (list all that should be on).
- Prefer `aspect` over raw width/height when framing changes.
- `vary: true` — new random seed. `lock_seed: true` — reuse current seed.
+38
View File
@@ -0,0 +1,38 @@
{
"generation": {
"profile": "turbo",
"steps": 8,
"cfg": 1,
"sigma_shift": 1.15,
"images": 1
},
"profiles": {
"turbo": {
"steps": 8,
"cfg": 1,
"sigma_shift": 1.15
},
"raw": {
"steps": 28,
"cfg": 4.5,
"sigma_shift": 1.15
}
},
"aspect_table": {
"1:1": [1024, 1024],
"4:3": [1184, 896],
"3:2": [1248, 832],
"16:9": [1376, 768],
"2.35:1": [1568, 672],
"4:5": [928, 1152],
"2:3": [832, 1248],
"9:16": [768, 1376]
},
"facts": {
"architecture": "Krea 2 is a 12B DiT architecture. Not FLUX, not SDXL, not FLUX.1-Krea. Text encoder: Qwen3-VL 4B. VAE: Qwen Image VAE. Use only Krea2-trained LoRAs — never suggest FLUX/SDXL LoRAs.",
"negatives": "Negative prompts are nearly useless with Qwen3-VL. Prefer positives (sharp focus, empty street) over no blur / no people. Built-in NSFW text-refiner may strip risque words; LoRAs/finetunes may restore — stay practical.",
"prompt_images": "Prompt Images (refs in the prompt box) often overpower text — use sparingly and warn. Init Image = structure (img2img). Mask = local fix. They are not interchangeable. Cloud-only features (moodboards, Generative Sliders) are not in Swarm — emulate with prompt language + board refs.",
"turbo": "Krea 2 Turbo defaults live in exact.generation / exact.profiles.turbo. Never use CFG 0 — broken output. Side ~1024 (1284096 OK).",
"raw": "Krea 2 RAW/Base: prefer exact.profiles.raw when checkpoint name/title looks like RAW (not Turbo). If a turbo LoRA exists, weight ~0.6 for photoreal (1.0 ≈ full turbo). Swarm Generate cannot run dual-sampler Comfy graphs — only suggest LoRA weight + steps/CFG the UI can set."
}
}
+2 -44
View File
@@ -1,50 +1,8 @@
[
{
"kind": "aspect",
"key": "1:1",
"key": "table",
"tags": ["aspect", "1k"],
"text": "Aspect 1:1 maps to 1024×1024 on the official Krea 1K table. Prefer patch field aspect over raw width/height."
},
{
"kind": "aspect",
"key": "4:3",
"tags": ["aspect", "1k"],
"text": "Aspect 4:3 maps to 1184×896."
},
{
"kind": "aspect",
"key": "3:2",
"tags": ["aspect", "1k"],
"text": "Aspect 3:2 maps to 1248×832."
},
{
"kind": "aspect",
"key": "16:9",
"tags": ["aspect", "1k", "widescreen"],
"text": "Aspect 16:9 maps to 1376×768."
},
{
"kind": "aspect",
"key": "2.35:1",
"tags": ["aspect", "1k", "cinematic"],
"text": "Aspect 2.35:1 (cinematic ultrawide) maps to 1568×672."
},
{
"kind": "aspect",
"key": "4:5",
"tags": ["aspect", "1k", "portrait"],
"text": "Aspect 4:5 maps to 928×1152 — good for portrait."
},
{
"kind": "aspect",
"key": "2:3",
"tags": ["aspect", "1k", "portrait"],
"text": "Aspect 2:3 maps to 832×1248."
},
{
"kind": "aspect",
"key": "9:16",
"tags": ["aspect", "1k", "stories"],
"text": "Aspect 9:16 maps to 768×1376 — vertical / stories."
"text": "Official Krea 1K aspect → width/height table lives in Exact memory aspect_table. Prefer patch field aspect over raw width/height. UI fills empties from Exact."
}
]
+5 -5
View File
@@ -3,30 +3,30 @@
"kind": "model",
"key": "krea2_architecture",
"tags": ["krea", "architecture"],
"text": "Krea 2 is a 12B DiT architecture. Not FLUX, not SDXL, not FLUX.1-Krea. Text encoder: Qwen3-VL 4B. VAE: Qwen Image VAE. Use only Krea2-trained LoRAs — never suggest FLUX/SDXL LoRAs."
"text": "Krea 2 architecture facts live in Exact memory (exact.facts.architecture). Prefer Exact KV over this note. Never suggest FLUX/SDXL LoRAs."
},
{
"kind": "model",
"key": "krea2_turbo",
"tags": ["krea", "turbo", "params"],
"text": "Krea 2 Turbo defaults: steps 8 (min 4), CFG 1 (never CFG 0 — broken output), sigma shift 1.15, side ~1024 (1284096 OK)."
"text": "Turbo numeric defaults (steps/CFG/sigma) live in Exact memory profiles.turbo / generation — do not invent numbers; never use CFG 0."
},
{
"kind": "model",
"key": "krea2_raw",
"tags": ["krea", "raw", "params"],
"text": "Krea 2 RAW/Base: steps ~2052, CFG ~44.5. If checkpoint name/title looks like RAW (not Turbo), prefer RAW settings. If a turbo LoRA exists, weight ~0.6 for photoreal (1.0 ≈ full turbo). Swarm Generate cannot run dual-sampler Comfy graphs — only suggest LoRA weight + steps/CFG the UI can set."
"text": "RAW numeric defaults live in Exact memory profiles.raw. If checkpoint looks like RAW (not Turbo), use that profile. Turbo LoRA weight ~0.6 for photoreal when needed."
},
{
"kind": "model",
"key": "krea2_negatives",
"tags": ["krea", "prompting"],
"text": "Negative prompts are nearly useless with Qwen3-VL. Prefer positives (sharp focus, empty street) over no blur / no people. Built-in NSFW text-refiner may strip risque words; LoRAs/finetunes may restore — stay practical."
"text": "See Exact memory facts.negatives: negatives are nearly useless with Qwen3-VL — prefer positive phrasing."
},
{
"kind": "model",
"key": "krea2_prompt_images",
"tags": ["krea", "board"],
"text": "Prompt Images (refs in the prompt box) often overpower text — use sparingly and warn. Init Image = structure (img2img). Mask = local fix. They are not interchangeable. Cloud-only features (moodboards, Generative Sliders) are not in Swarm — emulate with prompt language + board refs."
"text": "See Exact memory facts.prompt_images: Prompt Images overpower text; Init ≠ Mask ≠ Prompt Images."
}
]
+1 -23
View File
@@ -1,26 +1,4 @@
{
"id": "krea2",
"gate_keywords": ["krea"],
"profiles": {
"turbo": {
"steps": 8,
"cfg": 1,
"sigma_shift": 1.15
},
"raw": {
"steps": 28,
"cfg": 4.5,
"sigma_shift": 1.15
}
},
"aspect_table": {
"1:1": [1024, 1024],
"4:3": [1184, 896],
"3:2": [1248, 832],
"16:9": [1376, 768],
"2.35:1": [1568, 672],
"4:5": [928, 1152],
"2:3": [832, 1248],
"9:16": [768, 1376]
}
"gate_keywords": ["krea"]
}
+4 -4
View File
@@ -4,16 +4,16 @@ Goal: adjust **generation parameters** for Krea 2 Turbo (or RAW if context says
## Guidelines
- **Turbo:** steps 412 (default **8**), CFG **1** (never 0), sigma shift ~**1.15**.
- **RAW/base:** steps 2052, CFG ~44.5 — only if checkpoint/context indicates Raw. If a turbo-distill LoRA is available, weight **0.6** is the usual photoreal compromise (UI LoRA only — no dual-sampler).
- Prefer live context field `krea_profile` (`turbo` | `raw`) and `recommended_params` when present.
- **Aspect:** prefer patch field `aspect` (`1:1`, `4:5`, `2:3`, `16:9`, `9:16`, `4:3`, `3:2`, `2.35:1`) — UI maps to official 1K sizes. Else set width/height near 1024.
- Prefer **Exact memory** (`profiles.turbo` / `profiles.raw`), live `recommended_params`, and `session_exact` over invented numbers. Never CFG 0.
- Prefer live context field `krea_profile` (`turbo` | `raw`) when present.
- **Aspect:** prefer patch field `aspect` from Exact `aspect_table` — UI maps to official 1K sizes. Else set width/height near 1024.
- **Batch:** `images` or `batch` (14 typical).
- **Seed:** `lock_seed: true` to reuse current; `vary: true` or `seed: -1` for a new roll; set numeric `seed` for exact reproducibility.
- **Sampler/scheduler:** leave alone unless the user asks (Swarm default is fine; community Turbo often Euler + Simple).
- **Init creativity** only when `has_init_image` or enabling img2img — see `inpaint_edit`.
- Do not change the prompt unless needed for the new framing.
- Keep LoRAs unless asked to drop them.
- Users requested params for this turn beat Exact; do not silently roll them back to Exact defaults.
## Deliverable
+1 -1
View File
@@ -15,7 +15,7 @@ Structure as flowing prose (not tag soup):
- Put **LoRA trigger phrases** near the subject they affect.
- Short user ideas → expand. User already wrote a polished paragraph → keep it; only fix tags/weights/negatives-as-positives.
- Keep Turbo defaults unless asked (steps 8, cfg 1). Prefer `aspect` for framing.
- Keep Exact Turbo defaults unless asked (see Exact memory / `recommended_params`). Prefer `aspect` for framing. Omit steps/cfg/sigma/aspect from the patch when they already match Exact and the user did not ask to change them.
- Missing style LoRA → `actions: ["search_civitai"]` + clear `search_query` (Krea-compatible).
- Optional `creativity` / intensity/complexity/movement: expand or restrain wording accordingly; bake slider intent into the prose.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"id": "memory",
"title": "Vector memory",
"title": "Exact + vector memory",
"default": true,
"prompt_file": "memory.md"
}
+10 -2
View File
@@ -1,8 +1,15 @@
# Skill: memory
You have a persistent vector memory (`memory_hits` in live context).
You have two memory layers:
## When to write
1. **Exact memory** (`## Exact memory` + live `exact` / `session_exact`) — canonical KV defaults (generation params, aspect table, architecture facts). Always prefer Exact over RAG for numbers and defaults.
2. **Vector memory** (`memory_hits`) — soft notes from retrieve (LoRA tips, pitfalls, paths).
## Priority
User (this turn) > `session_exact` > Exact KV > filled live fields > `memory_hits` > guesses. Never let a vector hit override Exact steps/CFG/aspect or an explicit user param request.
## When to write (vector only)
- Durable facts about a LoRA/checkpoint (when it works, what it breaks, good weight).
- Bad paths / pitfalls you discovered this session.
@@ -10,6 +17,7 @@ You have a persistent vector memory (`memory_hits` in live context).
## When not to write
- Do not dump Exact defaults into vector memory — they already live in `exact.json`.
- Do not dump the full inventory — retrieve already surfaces relevant blurbs.
- Do not store the user's taste profile (that is `taste_profile` / taste.json).
- Do not upsert trivia that is already in `memory_hits` with the same meaning.
+5
View File
@@ -0,0 +1,5 @@
{
"generation": {
"aspect": "2.35:1"
}
}