Skip to content

SiliconeShojo/Codex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codex - Wildcard Gallery for Stable Diffusion WebUI

Extension Preview


📖 Table of Contents


🚀 What is Codex?

Codex is a visual wildcard manager and gallery system for Stable Diffusion. It solves the problem of managing thousands of text prompts by providing a visual card-based interface.

Key Capabilities:

  • 🖼️ Visual Browser: Organize wildcards as cards in the Extra Networks panel.
  • ⚡ One-Click Insertion: Click a card to insert the wildcard path directly into your prompt.
  • 🎲 Advanced Engine: Native support for standard wildcards, variants ({a|b}), and sampling.
  • 📸 Preview System: Generate preview images to see exactly what a wildcard produces before you use it.
  • 🔧 Zero Dependencies: Works out of the box. No other extensions required.

📥 Installation

Method 1: Install from URL (Recommended)

  1. Open Stable Diffusion WebUI.
  2. Go to ExtensionsInstall from URL.
  3. Paste this repository URL.
  4. Click Install.
  5. Restart the WebUI completely.

Method 2: Manual Install

Clone the repo into your extensions folder:

git clone https://github.com/SiliconeShojo/Codex.git

📝 Wildcard Management & Syntax

Codex uses its own internal directory for wildcards. Location: extensions/codex/wildcards/

📂 1. File Formats (Click to expand)

You can use simple .txt files or structured .yaml files.

TXT Files (Simple Lists)

Create extensions/codex/wildcards/characters/heroes.txt:

# This is a comment
a brave knight in shining armor
a mysterious wizard
a cyberpunk netrunner

Usage: __characters/heroes__

YAML Files (Structured Categories)

Create extensions/codex/wildcards/styles.yaml:

artistic:
  oil:
    - thick impasto oil painting
    - classical oil portrait
  watercolor:
    - soft watercolor style
    - wet-on-wet technique

Usage: __styles/artistic/oil__

🎲 2. Dynamic Syntax Guide (Click to expand)

Codex features a built-in parser for advanced prompting logic.

Type Syntax Result
Standard __filename__ Picks 1 random line from a .txt file or .yaml category.
Variants {red|blue|green} Randomly chooses one option (e.g., "red").
Sampling __3$$colors__ Picks 3 unique entries, joined by the default , .
Sampling __5$$|$$adjectives__ Picks 5 entries, joined by a custom separator |.
Nested __meta_wildcard__ Wildcards inside wildcards are automatically resolved.

Avoid extra spaces: The parser is space-sensitive. Use __3$$colors__ rather than __3$$ colors__ to ensure the name matches your local wildcard files or YAML keys exactly.


🎨 Visual Gallery & Previews

Using the Gallery

  1. Navigate to the Extra Networks panel (where Lora/Checkpoints are).
  2. Click the "Codex" tab.
  3. Clicking a card inserts the syntax (e.g., __wildcard__) into your prompt.

Generating Previews

Make your gallery beautiful by generating preview images for your text files.

  1. Go to txt2img.
  2. Open the "Codex Preview Manager" script in the scripts dropdown.
  3. Select Wildcards: Use the dropdown or path selector to choose files.
  4. Insertion Method:
    • AFTER/BEFORE: Appends wildcard to current prompt.
    • SEARCH & REPLACE: Replaces specific text with the wildcard.
  5. Click Generate.

❓ Troubleshooting

Wildcards not showing?
  • Ensure files are in extensions/codex/wildcards/.
  • Ensure file extensions are .txt or .yaml.
  • Check the console for [Codex] indexing logs.
Previews not generating?
  • Verify the "Codex Preview Manager" script is active.
  • Ensure you have selected a wildcard in the script dropdown.
Wildcards not replacing in generation?
  • Check "Enable Wildcard Replacement" in the Codex accordion.
  • Verify the wildcard name matches the filename exactly.

Credits & Attribution

This project builds upon the excellent work of:

Special thanks to both projects for their innovative approaches to prompt management in Stable Diffusion.


Changelog

[1.1.0] - 2026-05-28

  • UI/UX layout improvements:

    • Implemented adaptive layout toggling: when the "Use Wildcard Branch Selector" checkbox is checked, the individual "Wildcards" dropdown automatically hides itself to maintain a clean workspace.
    • Converted the root input textarea into a dynamic Dropdown choice list that parses and lists root folders automatically.
  • Thread-safety & Concurrency:

    • Implemented an atomic dictionary state swap during wildcard indexing walks, preventing file-access collisions ("Access is denied") under concurrent threads.
    • Added a safe NoneType fallback check when the branch selector is inactive.
  • Performance & VRAM optimization:

    • Integrated PyTorch active GPU memory garbage collection between preview generation batches.
    • Configured auto-downscaling of newly generated preview images to 512px.
    • Added a generator-based script workflow to optimize and resize existing card previews.
    • Removed heavy, high-overhead 3D CSS perspective transforms and animated backgrounds.

About

A wildcard management extension for Stable Diffusion WebUI.

Topics

Resources

License

Stars

Watchers

Forks

Contributors