造符
於 viz/ 視層造 R 基象圖符為技、代、團標。各符為純 ggplot2 函,於 100x100 畫繪可識形、以霓暈效渲為透 WebP。
用
- 新技、代、團已加須視標
- 存符須換或重設
- 為新技域批造符
- 試視喻為項概
入
- 必:項型 —
skill、agent、team
- 必:項 ID(如
create-glyph、mystic、r-package-review)與域(技時)
- 必:視概——符當繪何
- 可:考符以評複
- 可:自定
--glow-sigma 值(默:4)
行
一:概——設視喻
識所符項並擇視喻。
- 讀項源以曉核概:
- 技:
skills/<id>/SKILL.md
- 代:
agents/<id>.md
- 團:
teams/<id>.md
- 擇喻型:
- 實物:實驗用瓶、安用盾
- 抽符:併用箭、迭用螺
- 合:合 2-3 簡形(如文+筆)
- 參存符以校複:
Complexity Tiers:
+----------+--------+-------------------------------------------+
| Tier | Layers | Examples |
+----------+--------+-------------------------------------------+
| Simple | 2 | glyph_flame, glyph_heartbeat |
| Moderate | 3-5 | glyph_document, glyph_experiment_flask |
| Complex | 6+ | glyph_ship_wheel, glyph_bridge_cpp |
+----------+--------+-------------------------------------------+
- 定函名:
glyph_<descriptive_name>(snake_case、獨)
得: 形之明心圖含 2-6 計層。
敗: 概過抽→退至相關實物。參同域存符為靈。
二:組——書符函
書生 ggplot2 層之 R 函。
函簽(不變約):
glyph_<name> <- function(cx, cy, s, col, bright) {
# cx, cy = center coordinates (50, 50 on 100x100 canvas)
# s = scale factor (1.0 = fill ~70% of canvas)
# col = domain color hex (e.g., "#ff88dd" for design)
# bright = brightened variant of col (auto-computed by renderer)
# Returns: list() of ggplot2 layers
}
施比因 * s 於諸寸為一致:
r <- 20 * s # radius
hw <- 15 * s # half-width
lw <- .lw(s) # line width (default base 2.5)
lw_thin <- .lw(s, 1.2) # thinner line width
以可用原建幾:
| 幾 |
用 |
ggplot2::geom_polygon(data, .aes(x, y), ...) |
填形 |
ggplot2::geom_path(data, .aes(x, y), ...) |
開線/曲 |
ggplot2::geom_segment(data, .aes(x, xend, y, yend), ...) |
線段、箭 |
ggplot2::geom_rect(data, .aes(xmin, xmax, ymin, ymax), ...) |
矩 |
ggforce::geom_circle(data, .aes(x0, y0, r), ...) |
圓 |
施色策:
Alpha Guide:
+----------------------+------------+--------------------------+
| Purpose | Alpha | Example |
+----------------------+------------+--------------------------+
| Large fill (body) | 0.08-0.15 | hex_with_alpha(col, 0.1) |
| Medium fill (accent) | 0.15-0.25 | hex_with_alpha(col, 0.2) |
| Small fill (detail) | 0.25-0.35 | hex_with_alpha(bright, 0.3) |
| Outline stroke | 1.0 | color = bright |
| Secondary stroke | 1.0 | color = col |
| No fill | --- | fill = NA |
+----------------------+------------+--------------------------+
返平 list() 層(渲器迭而以暈包各)
按項型置函於合原檔:
- 技:19 原檔按域組
- 代:
viz/R/agent_primitives.R
- 團:
viz/R/team_primitives.R
得: 返 2-6 ggplot2 層之可用 R 函。
敗: ggforce::geom_circle 誤→保 ggforce 裝。坐偏→記畫 100x100、(0,0) 於左下。交互試:
source("viz/R/utils.R"); source("viz/R/primitives.R")
layers <- glyph_<name>(50, 50, 1.0, "#ff88dd", "#ffa8f0")
p <- ggplot2::ggplot() + ggplot2::coord_fixed(xlim=c(0,100), ylim=c(0,100)) +
ggplot2::theme_void()
for (l in layers) p <- p + l
print(p)
三:註——映項至符
於合符映檔加項符映。
技: 開 viz/R/glyphs.R、於域塊內按字母序加 "skill-id" = "glyph_function_name",
代: 開 viz/R/agent_glyphs.R、於 AGENT_GLYPHS 加同樣項
團: 開 viz/R/team_glyphs.R、於 TEAM_GLYPHS 加同樣項
驗目列無重 ID。
得: 合 *_GLYPHS 列含新映。
敗: 構報「No glyph mapped」→復察項 ID 合備與庫。
四:備——加標項
於合備檔註標。
技: viz/data/icon-manifest.json
{
"skillId": "skill-id",
"domain": "domain-name",
"prompt": "<domain basePrompt>, <descriptors>, dark background, vector art",
"seed": <next_seed>,
"path": "public/icons/cyberpunk/<domain>/<skill-id>.webp",
"status": "pending"
}
代: viz/data/agent-icon-manifest.json(用 agentId 與 public/icons/cyberpunk/agents/<agent-id>.webp)
團: viz/data/team-icon-manifest.json(用 teamId 與 public/icons/cyberpunk/teams/<team-id>.webp)
得: 有效 JSON 含新項置於同型兄弟。
敗: 驗 JSON 文法。常誤:末陣元後遺逗、缺引。
五:渲——生標
行標流渲新符。恆用 build.sh 為入——理平台辨與 R 二擇。見 render-icon-pipeline 全旗考與流架。
# From project root — renders all palettes, standard + HD, skips existing icons
bash viz/build.sh --only <domain> --skip-existing # skills
bash viz/build.sh --type agent --only <id> --skip-existing # agents
bash viz/build.sh --type team --only <id> --skip-existing # teams
# Dry run first:
bash viz/build.sh --only <domain> --dry-run
build.sh 行全流(palette → data → manifest → render → terminal glyphs)。
出位:
- 技:
viz/public/icons/<palette>/<domain>/<skill-id>.webp
- 代:
viz/public/icons/<palette>/agents/<agent-id>.webp
- 團:
viz/public/icons/<palette>/teams/<team-id>.webp
得: 誌顯 OK: <entity> (seed=XXXXX, XX.XKB) 而 WebP 檔存。
敗:
"No glyph mapped" — 步三映缺或錯
"Unknown domain" — 域不於 palettes.R 之 get_palette_colors()
- R 包誤 — 先行
install.packages(c("ggplot2", "ggforce", "ggfx", "ragg", "magick"))
- 渲崩→交互試符函
六:驗——視察
察渲出合質準。
驗檔存且寸合:
ls -la viz/public/icons/cyberpunk/<type-path>/<entity-id>.webp
# Expected: 15-80 KB typical range
以像視開 WebP 察:
- 形於全寸(1024x1024)清讀
- 霓暈存而不蓋
- 背透(無黑白矩)
- 畫邊無裁
於小寸察(力圖中標渲於~40-160px):
得: 清、可識之象圖含透背之均霓暈。
敗:
- 暈強→以
--glow-sigma 2 重渲
- 暈弱→以
--glow-sigma 8 重渲
- 小寸不讀→簡符、粗筆、增
.lw(s, base)
- 邊裁→減形寸或移中
七:迭——若需則精
調而重渲。
常調:
- 粗筆:增
.lw(s, base) — 試 base = 3.0 或 3.5
- 更顯填:alpha 自 0.10 增至 0.15-0.20
- 形比:調
s 之乘(如 20 * s -> 24 * s)
- 加/減細層:總層保於 2-6
改後重渲:刪存標、用合構令重渲
滿時驗備態顯 "done"
得: 終標通步六諸察。
敗: 3+ 迭後符仍不讀→考全異視喻(返步一)。
考
域與項色盤
域色(技)定於 viz/R/palettes.R(唯真源)。代與團色亦理於 palettes.R。cyberpunk 色盤於 get_cyberpunk_colors()。
source("viz/R/palettes.R")
get_palette_colors("cyberpunk")$domains[["design"]]
get_palette_colors("cyberpunk")$agents[["mystic"]]
get_palette_colors("cyberpunk")$teams[["tending"]]
加新域時於 palettes.R 三處加:PALETTE_DOMAIN_ORDER(字母)、get_cyberpunk_colors() 域列、行 bash viz/build.sh 重生。
符函錄
- 技:
viz/R/primitives.R 至 viz/R/primitives_19.R(按域組)
- 代:
viz/R/agent_primitives.R
- 團:
viz/R/team_primitives.R
助函
| 函 |
簽 |
目 |
.lw(s, base) |
(scale, base=2.5) |
比覺線寬 |
.aes(...) |
ggplot2::aes 別 |
簡美映 |
hex_with_alpha(hex, alpha) |
(string, 0-1) |
加 alpha 於 hex 色 |
brighten_hex(hex, factor) |
(string, factor=1.3) |
亮 hex 色 |
dim_hex(hex, factor) |
(string, factor=0.4) |
暗 hex 色 |
驗
忌
- 忘
* s:硬碼素值比變時破
- 畫原惑:(0,0) 於左下、非左上
- 雙暈:渲器已施
ggfx::with_outer_glow()、勿於符函內加暈
- 層過多:過 8 層渲慢且視噪
- ID 不合:符映、備、庫之項 ID 須皆合
- JSON 末逗:備為嚴 JSON、末陣元後無逗
- 域色缺:域不於
get_cyberpunk_colors()→渲誤
- 誤原檔:技於
primitives*.R、代於 agent_primitives.R、團於 team_primitives.R
參
1---2name: create-glyph-93description: Create R-based pictogram glyphs for skill, agent, or team icons in the visualization layer. Covers concept sketching, ggplot2 layer composition using the primitives library, color strategy, registration in the appropriate glyph mapping file and manifest, rendering via the build pipeline, and visual verification of the neon-glow output. Use when a new entity has been added and needs a visual icon for the force-graph visualization, an existing glyph needs replacement, or when batch-creating glyphs for a new domain.4license: MIT5---67# 造符89於 `viz/` 視層造 R 基象圖符為技、代、團標。各符為純 ggplot2 函,於 100x100 畫繪可識形、以霓暈效渲為透 WebP。1011## 用1213- 新技、代、團已加須視標14- 存符須換或重設15- 為新技域批造符16- 試視喻為項概1718## 入1920- **必**:項型 — `skill`、`agent`、`team`21- **必**:項 ID(如 `create-glyph`、`mystic`、`r-package-review`)與域(技時)22- **必**:視概——符當繪何23- **可**:考符以評複24- **可**:自定 `--glow-sigma` 值(默:4)2526## 行2728### 一:概——設視喻2930識所符項並擇視喻。31321. 讀項源以曉核概:33 - 技:`skills/<id>/SKILL.md`34 - 代:`agents/<id>.md`35 - 團:`teams/<id>.md`362. 擇喻型:37 - **實物**:實驗用瓶、安用盾38 - **抽符**:併用箭、迭用螺39 - **合**:合 2-3 簡形(如文+筆)403. 參存符以校複:4142```text43Complexity Tiers:44+----------+--------+-------------------------------------------+45| Tier | Layers | Examples |46+----------+--------+-------------------------------------------+47| Simple | 2 | glyph_flame, glyph_heartbeat |48| Moderate | 3-5 | glyph_document, glyph_experiment_flask |49| Complex | 6+ | glyph_ship_wheel, glyph_bridge_cpp |50+----------+--------+-------------------------------------------+51```52534. 定函名:`glyph_<descriptive_name>`(snake_case、獨)5455**得:** 形之明心圖含 2-6 計層。5657**敗:** 概過抽→退至相關實物。參同域存符為靈。5859### 二:組——書符函6061書生 ggplot2 層之 R 函。62631. 函簽(不變約):64 ```r65 glyph_<name> <- function(cx, cy, s, col, bright) {66 # cx, cy = center coordinates (50, 50 on 100x100 canvas)67 # s = scale factor (1.0 = fill ~70% of canvas)68 # col = domain color hex (e.g., "#ff88dd" for design)69 # bright = brightened variant of col (auto-computed by renderer)70 # Returns: list() of ggplot2 layers71 }72 ```73742. 施比因 `* s` 於諸寸為一致:75 ```r76 r <- 20 * s # radius77 hw <- 15 * s # half-width78 lw <- .lw(s) # line width (default base 2.5)79 lw_thin <- .lw(s, 1.2) # thinner line width80 ```81823. 以可用原建幾:8384 | 幾 | 用 |85 |---|---|86 | `ggplot2::geom_polygon(data, .aes(x, y), ...)` | 填形 |87 | `ggplot2::geom_path(data, .aes(x, y), ...)` | 開線/曲 |88 | `ggplot2::geom_segment(data, .aes(x, xend, y, yend), ...)` | 線段、箭 |89 | `ggplot2::geom_rect(data, .aes(xmin, xmax, ymin, ymax), ...)` | 矩 |90 | `ggforce::geom_circle(data, .aes(x0, y0, r), ...)` | 圓 |91924. 施色策:9394 ```text95 Alpha Guide:96 +----------------------+------------+--------------------------+97 | Purpose | Alpha | Example |98 +----------------------+------------+--------------------------+99 | Large fill (body) | 0.08-0.15 | hex_with_alpha(col, 0.1) |100 | Medium fill (accent) | 0.15-0.25 | hex_with_alpha(col, 0.2) |101 | Small fill (detail) | 0.25-0.35 | hex_with_alpha(bright, 0.3) |102 | Outline stroke | 1.0 | color = bright |103 | Secondary stroke | 1.0 | color = col |104 | No fill | --- | fill = NA |105 +----------------------+------------+--------------------------+106 ```1071085. 返平 `list()` 層(渲器迭而以暈包各)1091106. 按項型置函於合原檔:111 - **技**:19 原檔按域組112 - **代**:`viz/R/agent_primitives.R`113 - **團**:`viz/R/team_primitives.R`114115**得:** 返 2-6 ggplot2 層之可用 R 函。116117**敗:** `ggforce::geom_circle` 誤→保 ggforce 裝。坐偏→記畫 100x100、(0,0) 於左下。交互試:118```r119source("viz/R/utils.R"); source("viz/R/primitives.R")120layers <- glyph_<name>(50, 50, 1.0, "#ff88dd", "#ffa8f0")121p <- ggplot2::ggplot() + ggplot2::coord_fixed(xlim=c(0,100), ylim=c(0,100)) +122 ggplot2::theme_void()123for (l in layers) p <- p + l124print(p)125```126127### 三:註——映項至符128129於合符映檔加項符映。130131**技:** 開 `viz/R/glyphs.R`、於域塊內按字母序加 `"skill-id" = "glyph_function_name",`132**代:** 開 `viz/R/agent_glyphs.R`、於 `AGENT_GLYPHS` 加同樣項133**團:** 開 `viz/R/team_glyphs.R`、於 `TEAM_GLYPHS` 加同樣項134135驗目列無重 ID。136137**得:** 合 `*_GLYPHS` 列含新映。138139**敗:** 構報「No glyph mapped」→復察項 ID 合備與庫。140141### 四:備——加標項142143於合備檔註標。144145**技:** `viz/data/icon-manifest.json`146```json147{148 "skillId": "skill-id",149 "domain": "domain-name",150 "prompt": "<domain basePrompt>, <descriptors>, dark background, vector art",151 "seed": <next_seed>,152 "path": "public/icons/cyberpunk/<domain>/<skill-id>.webp",153 "status": "pending"154}155```156157**代:** `viz/data/agent-icon-manifest.json`(用 `agentId` 與 `public/icons/cyberpunk/agents/<agent-id>.webp`)158159**團:** `viz/data/team-icon-manifest.json`(用 `teamId` 與 `public/icons/cyberpunk/teams/<team-id>.webp`)160161**得:** 有效 JSON 含新項置於同型兄弟。162163**敗:** 驗 JSON 文法。常誤:末陣元後遺逗、缺引。164165### 五:渲——生標166167行標流渲新符。恆用 `build.sh` 為入——理平台辨與 R 二擇。見 [render-icon-pipeline](../render-icon-pipeline/SKILL.md) 全旗考與流架。168169```bash170# From project root — renders all palettes, standard + HD, skips existing icons171bash viz/build.sh --only <domain> --skip-existing # skills172bash viz/build.sh --type agent --only <id> --skip-existing # agents173bash viz/build.sh --type team --only <id> --skip-existing # teams174175# Dry run first:176bash viz/build.sh --only <domain> --dry-run177```178179`build.sh` 行全流(palette → data → manifest → render → terminal glyphs)。180181出位:182 - 技:`viz/public/icons/<palette>/<domain>/<skill-id>.webp`183 - 代:`viz/public/icons/<palette>/agents/<agent-id>.webp`184 - 團:`viz/public/icons/<palette>/teams/<team-id>.webp`185186**得:** 誌顯 `OK: <entity> (seed=XXXXX, XX.XKB)` 而 WebP 檔存。187188**敗:**189- `"No glyph mapped"` — 步三映缺或錯190- `"Unknown domain"` — 域不於 `palettes.R` 之 `get_palette_colors()`191- R 包誤 — 先行 `install.packages(c("ggplot2", "ggforce", "ggfx", "ragg", "magick"))`192- 渲崩→交互試符函193194### 六:驗——視察195196察渲出合質準。1971981. 驗檔存且寸合:199 ```bash200 ls -la viz/public/icons/cyberpunk/<type-path>/<entity-id>.webp201 # Expected: 15-80 KB typical range202 ```2032042. 以像視開 WebP 察:205 - 形於全寸(1024x1024)清讀206 - 霓暈存而不蓋207 - 背透(無黑白矩)208 - 畫邊無裁2092103. 於小寸察(力圖中標渲於~40-160px):211 - 形仍可識212 - 細不化噪213 - 暈不蓋形214215**得:** 清、可識之象圖含透背之均霓暈。216217**敗:**218- 暈強→以 `--glow-sigma 2` 重渲219- 暈弱→以 `--glow-sigma 8` 重渲220- 小寸不讀→簡符、粗筆、增 `.lw(s, base)`221- 邊裁→減形寸或移中222223### 七:迭——若需則精224225調而重渲。2262271. 常調:228 - **粗筆**:增 `.lw(s, base)` — 試 `base = 3.0` 或 `3.5`229 - **更顯填**:alpha 自 0.10 增至 0.15-0.20230 - **形比**:調 `s` 之乘(如 `20 * s` -> `24 * s`)231 - **加/減細層**:總層保於 2-62322332. 改後重渲:刪存標、用合構令重渲2342353. 滿時驗備態顯 `"done"`236237**得:** 終標通步六諸察。238239**敗:** 3+ 迭後符仍不讀→考全異視喻(返步一)。240241## 考242243### 域與項色盤244245域色(技)定於 `viz/R/palettes.R`(唯真源)。代與團色亦理於 `palettes.R`。cyberpunk 色盤於 `get_cyberpunk_colors()`。246247```r248source("viz/R/palettes.R")249get_palette_colors("cyberpunk")$domains[["design"]]250get_palette_colors("cyberpunk")$agents[["mystic"]]251get_palette_colors("cyberpunk")$teams[["tending"]]252```253254加新域時於 `palettes.R` 三處加:`PALETTE_DOMAIN_ORDER`(字母)、`get_cyberpunk_colors()` 域列、行 `bash viz/build.sh` 重生。255256### 符函錄257258- **技**:`viz/R/primitives.R` 至 `viz/R/primitives_19.R`(按域組)259- **代**:`viz/R/agent_primitives.R`260- **團**:`viz/R/team_primitives.R`261262### 助函263264| 函 | 簽 | 目 |265|---|---|---|266| `.lw(s, base)` | `(scale, base=2.5)` | 比覺線寬 |267| `.aes(...)` | `ggplot2::aes` 別 | 簡美映 |268| `hex_with_alpha(hex, alpha)` | `(string, 0-1)` | 加 alpha 於 hex 色 |269| `brighten_hex(hex, factor)` | `(string, factor=1.3)` | 亮 hex 色 |270| `dim_hex(hex, factor)` | `(string, factor=0.4)` | 暗 hex 色 |271272## 驗273274- [ ] 符函循 `glyph_<name>(cx, cy, s, col, bright) -> list()` 簽275- [ ] 諸寸用 `* s` 比因276- [ ] 色策填用 `col`、廓用 `bright`、透用 `hex_with_alpha()`277- [ ] 函置於合項型與域之原檔278- [ ] 符映項加於合 `*_glyphs.R`279- [ ] 備項含正項 ID、路、`"status": "pending"`280- [ ] 構令無誤行(先試行)281- [ ] 渲 WebP 存於期路282- [ ] 檔寸於期範(15-80 KB)283- [ ] 標於 1024px 與~40px 顯寸皆清讀284- [ ] 透背(符後無實矩)285- [ ] 成渲後備態更為 `"done"`286287## 忌288289- **忘 `* s`**:硬碼素值比變時破290- **畫原惑**:(0,0) 於左下、非左上291- **雙暈**:渲器已施 `ggfx::with_outer_glow()`、勿於符函內加暈292- **層過多**:過 8 層渲慢且視噪293- **ID 不合**:符映、備、庫之項 ID 須皆合294- **JSON 末逗**:備為嚴 JSON、末陣元後無逗295- **域色缺**:域不於 `get_cyberpunk_colors()`→渲誤296- **誤原檔**:技於 `primitives*.R`、代於 `agent_primitives.R`、團於 `team_primitives.R`297298## 參299300- [enhance-glyph](../enhance-glyph/SKILL.md) — 精存符視質301- [audit-icon-pipeline](../audit-icon-pipeline/SKILL.md) — 察缺符標302- [render-icon-pipeline](../render-icon-pipeline/SKILL.md) — 全端對端行渲流303- [ornament-style-mono](../ornament-style-mono/SKILL.md) — 補 AI 基像生304- [ornament-style-color](../ornament-style-color/SKILL.md) — 施於符飾填決之色理305- [create-skill](../create-skill/SKILL.md) — 觸符造之父流