executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
create-glyph创建基于R的象形符号(glyph),用于可视化层中的技能、代理或团队图标。涵盖概念 草图设计、使用基元库进行ggplot2图层组合、配色策略、在相应的符号映射文件和清单 中注册、通过构建流水线渲染,以及对霓虹发光输出的视觉验证。适用于新增实体需要 力导向图可视化图标、现有符号需要替换、或批量创建新领域符号的场景。
Independent GitHub snapshot · Automated classification · Original documentation governs
为 viz/ 可视化层创建基于R的象形符号。每个符号都是一个纯 ggplot2 函数,在 100x100 画布上绘制可辨识的图形,以霓虹发光效果渲染为透明背景的 WebP 格式。
skill、agent 或 teamcreate-glyph、mystic、r-package-review)及领域(技能适用)--glow-sigma 值(默认:4)确定需要图标化的实体,并选择合适的视觉隐喻。
skills/<id>/SKILL.mdagents/<id>.mdteams/<id>.mdComplexity 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_<描述性名称>(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() 图层列表(渲染器逐一迭代并为每个图层包裹发光效果)
根据实体类型将函数放置在相应的基元文件中:
primitives.R — bushcraft, compliance, containerization, data-serialization, defensiveprimitives_2.R — devops, general, git, mcp-integrationprimitives_3.R — mlops, observability, PM, r-packages, reporting, review, web-dev, esoteric, designprimitives_4.R 至 primitives_19.R 用于较新的领域viz/R/agent_primitives.Rviz/R/team_primitives.R预期结果: 一个可运行的 R 函数,返回包含 2-6 个 ggplot2 图层的列表。
失败时: 如果 ggforce::geom_circle 报错,请确保已安装 ggforce。如果坐标有偏差,请记住画布为 100x100,(0,0) 位于左下角。交互式测试函数:
source("viz/R/utils.R"); source("viz/R/primitives.R") # etc.
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# -- design (3))"skill-id" = "glyph_function_name",
代理:
viz/R/agent_glyphs.RAGENT_GLYPHS 中找到按字母排列的正确位置"agent-id" = "glyph_function_name",
团队:
打开 viz/R/team_glyphs.R
在 TEAM_GLYPHS 中找到按字母排列的正确位置
添加条目:
"team-id" = "glyph_function_name",
验证目标列表中没有重复的 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": "agent-id",
"prompt": "<agent-specific descriptors>, dark background, vector art",
"seed": <next_seed>,
"path": "public/icons/cyberpunk/agents/<agent-id>.webp",
"status": "pending"
}
团队: viz/data/team-icon-manifest.json
{
"teamId": "team-id",
"prompt": "<team-specific descriptors>, dark background, vector art",
"seed": <next_seed>,
"path": "public/icons/cyberpunk/teams/<team-id>.webp",
"status": "pending"
}
预期结果: 有效的 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 会运行完整流水线(调色板 → 数据 → 清单 → 渲染 → 终端字形)。非渲染步骤约需 10 秒,但可确保所有数据都是最新的。
输出位置:
viz/public/icons/<palette>/<domain>/<skill-id>.webpviz/public/icons/<palette>/agents/<agent-id>.webpviz/public/icons/<palette>/teams/<team-id>.webp预期结果: 日志显示 OK: <entity> (seed=XXXXX, XX.XKB),WebP 文件存在。
失败时:
"No glyph mapped" — 步骤 3 的映射缺失或存在拼写错误"Unknown domain" — 领域不在 palettes.R 的 get_palette_colors() 中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 检查:
在小尺寸下检查(图标在力导向图中以约 40-160px 渲染):
预期结果: 在透明背景上呈现清晰、可辨识的象形图,霓虹发光均匀。
失败时:
--glow-sigma 2 重新渲染(默认为 4)--glow-sigma 8 重新渲染.lw(s, base) 基础值)进行调整并重新渲染。
常见调整:
.lw(s, base) — 尝试 base = 3.0 或 3.5s 的乘数(例如 20 * s -> 24 * s)修改后重新渲染:
# Delete the existing icon first, then re-render
rm viz/public/icons/cyberpunk/<type-path>/<entity-id>.webp
# Use the appropriate build command from Step 5
满意后,验证清单状态显示 "done"(构建脚本在成功时会自动更新)
预期结果: 最终图标通过步骤 6 的所有验证检查。
失败时: 如果经过 3 次以上迭代符号仍然不理想,考虑使用完全不同的视觉隐喻(回到步骤 1)。
所有领域颜色(技能用)定义在 viz/R/palettes.R 中(唯一的真实数据来源)。代理和团队颜色也在 palettes.R 中管理。cyberpunk 调色板(手动调整的霓虹色)在 get_cyberpunk_colors() 中。Viridis 系列调色板通过 viridisLite 自动生成。
查找颜色:
source("viz/R/palettes.R")
get_palette_colors("cyberpunk")$domains[["design"]] # skill domain
get_palette_colors("cyberpunk")$agents[["mystic"]] # agent
get_palette_colors("cyberpunk")$teams[["tending"]] # team
添加新领域时,需在 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.Rviz/R/team_primitives.R| 函数 | 签名 | 用途 |
|---|---|---|
.lw(s, base) | (scale, base=2.5) | 缩放感知的线宽 |
.aes(...) | ggplot2::aes 的别名 | 简写美学映射 |
hex_with_alpha(hex, alpha) | (string, 0-1) | 为十六进制颜色添加透明度 |
brighten_hex(hex, factor) | (string, factor=1.3) | 提亮十六进制颜色 |
dim_hex(hex, factor) | (string, factor=0.4) | 调暗十六进制颜色 |
glyph_<name>(cx, cy, s, col, bright) -> list() 签名* s 缩放因子col 填充、bright 描边、hex_with_alpha() 控制透明度*_glyphs.R 文件中添加了符号映射条目"status": "pending""done"* s:硬编码的像素值在缩放改变时会失效。始终乘以 s。y 值越大越往上。ggfx::with_outer_glow()。不要在符号函数内部再添加发光效果。palettes.R 的 get_cyberpunk_colors() 中,渲染会报错。先添加颜色,再重新生成。primitives*.R 中,代理放在 agent_primitives.R 中,团队放在 team_primitives.R 中。