Enhance glyph

From pjt222/agent-almanac · View interactive version

Enhance glyph is an AI agent skill from the GitHub repository pjt222/agent-almanac. Improve an existing R-based pictogram glyph for the visualization layer. Covers visual audit of the current glyph, diagnosis of specific issues (proportions, readability, glow balance), targeted modifications to the glyph function, re-rendering, and before/after comparison. Works for skill, agent, a

How to use this skill

Skill file

Enhance Glyph

Improve an existing pictogram glyph in the viz/ visualization layer — audit its current rendering, diagnose visual issues, apply targeted modifications, re-render, and compare before/after. Works for skill, agent, and team glyphs.

When to Use

Inputs

Procedure

Step 1: Audit — Assess Current State

Examine the current glyph and identify specific issues.

  1. Locate the glyph function based on entity type:
  1. Read the glyph function to understand its structure:
  1. View the rendered output:
  1. Score the glyph on the quality dimensions:
Glyph Quality Dimensions:
+----------------+------+-----------------------------------------------+
| Dimension      | 1-5  | Assessment Criteria                           |
+----------------+------+-----------------------------------------------+
| Readability    |      | Recognizable at 48px? Clear at 160px?         |
| Proportions    |      | Well-centered? Good use of the 100x100 canvas?|
| Metaphor       |      | Does the shape clearly represent the entity?   |
| Glow balance   |      | Glow enhances without overwhelming?            |
| Palette compat |      | Looks good across cyberpunk + viridis palettes?|
| Complexity     |      | Appropriate layer count (not too busy/sparse)? |
+----------------+------+-----------------------------------------------+
  1. Identify the 1-2 dimensions with the lowest scores — these are the enhancement targets

Got: A clear diagnosis of what's wrong with the glyph and which dimensions to improve. The audit should be specific: "proportions: glyph uses only 40% of canvas" not "looks bad."

If fail: If the glyph function is missing or the entity isn't in its *_glyphs.R mapping, the glyph may not have been created yet — use create-glyph instead.

Step 2: Diagnose — Root Cause Analysis

Determine why the identified issues exist.

  1. For readability issues:
  1. For proportion issues:
  1. For glow issues:
  1. For palette compatibility issues:
  1. Document the specific root cause for each issue

Got: Root causes that directly point to code changes. "The glyph is too small" -> "scale factor is 0.6 but should be 0.8." "Glow overwhelms" -> "three overlapping filled polygons each generate glow."

If fail: If the root cause isn't obvious from code inspection, render the glyph in isolation with different parameters to isolate the issue. Use render_glyph() with a single glyph to test.

Step 3: Modify — Apply Targeted Fixes

Edit the glyph function to address the diagnosed issues.

  1. Open the file containing the glyph function
  2. Apply modifications specific to the diagnosis:
  1. Follow the glyph function contract:

```r

glyph_name <- function(cx, cy, s, col, bright) {

# cx, cy = center (50, 50)

# s = scale (1.0 = ~70% of canvas)

# col = domain color, bright = brightened variant

# Returns: list() of ggplot2 layers

}

```

  1. Preserve the function signature — do not change parameters
  2. Keep modifications minimal: fix the diagnosed issues, don't redesign the entire glyph

Got: A modified glyph function that addresses the specific issues identified in Steps 1-2. Changes are targeted and minimal — enhance, don't redesign.

If fail: If the modifications make other dimensions worse (e.g., fixing proportions breaks readability), revert and try a different approach. If the glyph needs a complete redesign, use create-glyph instead.

Step 4: Re-render — Generate Updated Icons

Render the modified glyph and verify the fix. Always use build.sh — it handles platform detection and R binary selection. See render-icon-pipeline for the full flag reference.

  1. Re-render based on entity type:

```bash

# From project root — use --no-cache to force re-render of modified glyph

bash viz/build.sh --only <domain> --no-cache # skills

bash viz/build.sh --type agent --only <id> --no-cache # agents

bash viz/build.sh --type team --only <id> --no-cache # teams

```

  1. Verify the output files exist at the expected path for each palette
  2. Check file sizes — icons should be 2-15 KB (WebP):

Got: Fresh icon files generated for all palettes. File sizes are in the expected range.

If fail: If the build script errors, check the R console output for the specific error. Common causes: missing closing parenthesis in the glyph function, referencing undefined primitives, or returning non-list from the function. If rendering succeeds but output is blank, the glyph layers may be outside the canvas bounds.

Step 5: Compare — Before/After Verification

Verify the enhancement improved the target dimensions.

  1. Compare old and new renderings:
  1. Re-score the quality dimensions from Step 1:
  1. If the glyph is used in the force-graph, test it there:
  1. Document the changes made and the improvement achieved

Got: Measurable improvement on the target dimensions with no regression on others. The glyph looks better at both sizes and across palettes.

If fail: If improvement is marginal or regression occurs, revert the changes and reconsider the diagnosis. Sometimes the original glyph's limitations are inherent to the metaphor, not the implementation — in that case, the metaphor itself may need to change (escalate to create-glyph).

Validation Checklist

Pitfalls

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.