Logo Forge Pipeline Library

Forge Pipeline Library

Cộng đồng
Nebulavenus
forge-pipeline-library

Sử dụng thư viện pipeline tài nguyên forge-gpu — gói Python được cài qua uv — để quét, tạo dấu vân tay, xử lý và đóng gói tài nguyên game bằng kiến trúc plugin. Dùng khi làm việc với mã pipeline, viết plugin, xử lý texture/mesh/animation, đóng gói tài nguyên hoặc mở rộng CLI của pipeline.

Tổng quan

Nhà phát hànhNebulavenus
Kho mãforge-gpu
Tên kỹ năngforge-pipeline-library
Sao
46
Bản fork
7
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépZlib
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được Nebulavenus công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Forge Pipeline Library trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-pipeline-library
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Nebulavenus/forge-gpu.git /tmp/forge-gpu
mkdir -p .claude/skills
cp -r /tmp/forge-gpu/.claude/skills/forge-pipeline-library .claude/skills/forge-pipeline-library
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Forge Pipeline Library trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Forge Pipeline Library ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Forge Pipeline Library với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

forge-pipeline-library

The forge asset pipeline is a Python package at the repo root (pipeline/), installed via uv sync. It processes raw game assets (textures, meshes, animations) into GPU-ready formats with incremental builds driven by content hashing.

When to use this skill

  • Writing or modifying pipeline code in pipeline/
  • Creating a new asset plugin (texture, mesh, animation, or custom)
  • Processing assets with the forge-pipeline CLI
  • Bundling processed assets into .forgepak archives
  • Debugging pipeline configuration or plugin discovery
  • Extending the pipeline with new file types or processing steps
  • Loading pipeline-processed assets in C/GPU code
  • Writing tests for pipeline modules

Installation

bash
# Install all dependencies from the lockfile (including dev extras)
uv sync --extra dev

# Verify
uv run forge-pipeline --help

The package is defined in pyproject.toml at the repo root. The CLI entry point is forge-pipeline, which maps to pipeline.__main__:main.

Package structure

text
pipeline/
├── __init__.py          # Package version (__version__ = "0.1.0")
├── __main__.py          # CLI entry point — argparse, scan, process, bundle
├── atlas.py             # Texture atlas packing (guillotine + shelf algorithms)
├── bundler.py           # .forgepak bundle writer/reader, dependency graph
├── config.py            # TOML config loader → PipelineConfig dataclass
├── import_settings.py   # Per-asset import settings (TOML sidecars, three-layer merge)
├── plugin.py            # AssetPlugin base class, PluginRegistry, discovery
├── scanner.py           # File scanning, SHA-256 fingerprinting, cache
├── server.py            # Web UI backend (FastAPI)
└── plugins/
    ├── __init__.py
    ├── animation.py     # AnimationPlugin — glTF animation → .fanim binary
    ├── atlas.py         # AtlasPlugin — texture atlas packing
    ├── mesh.py          # MeshPlugin — deduplicate, optimize, tangents, LOD
    ├── scene.py         # ScenePlugin — glTF scene hierarchy → .fscene binary
    └── texture.py       # TexturePlugin — resize, mipmaps, GPU compression

Core modules

config.py — Configuration

python
from pipeline.config import load_config, default_config, PipelineConfig, ConfigError

# Load from TOML file
config = load_config(Path("pipeline.toml"))

# Use defaults if no file exists
config = default_config()

# Access typed fields
config.source_dir   # Path — where raw assets live
config.output_dir   # Path — where processed files go
config.cache_dir    # Path — fingerprint cache location
config.plugin_settings  # dict[str, dict] — per-plugin config sections
config.raw          # dict — full parsed TOML for forward-compatibility

TOML structure:

toml
[pipeline]
source_dir = "assets/raw"
output_dir = "assets/processed"
cache_dir  = ".forge-cache"

[texture]
max_size = 2048
generate_mipmaps = true
output_format = "png"
compression = "none"        # none, basisu, or astc

[mesh]
deduplicate = true
optimize = true
generate_tangents = true
lod_levels = [1.0, 0.5, 0.25]

[animation]
tool_path = ""              # override forge-anim-tool location

Per-plugin sections (everything except [pipeline]) are passed to plugins as the settings dict in their process() method.

plugin.py — Plugin system

python
from pipeline.plugin import AssetPlugin, AssetResult, PluginRegistry

# Base class — subclass this to create a new plugin
class MyPlugin(AssetPlugin):
    name = "my-type"
    extensions = [".xyz", ".abc"]

    def process(self, source: Path, output_dir: Path, settings: dict) -> AssetResult:
        output = output_dir / f"{source.stem}.processed"
        # ... do work ...
        return AssetResult(source=source, output=output, metadata={"key": "val"})

# Registry — discovers and stores plugins
registry = PluginRegistry()
registry.register(MyPlugin())                # manual registration
count = registry.discover(Path("plugins/"))  # file-based discovery

# Lookup
plugins = registry.get_by_extension(".xyz")  # returns list[AssetPlugin]
plugin = registry.get_by_name("my-type")     # returns AssetPlugin | None
all_exts = registry.supported_extensions     # set[str]
all_plugins = registry.plugins               # list[AssetPlugin]

Discovery rules:

  • Scans *.py files in a directory (skips _-prefixed files)
  • Imports each module, finds AssetPlugin subclasses with a non-empty name
  • Only registers classes defined in that module (not imported base classes)
  • Multiple plugins can handle the same extension (all are invoked)

scanner.py — Fingerprinting and change detection

python
from pipeline.scanner import scan, fingerprint_file, FingerprintCache, FileStatus, ScannedFile

# Fingerprint a single file
digest = fingerprint_file(Path("texture.png"))  # SHA-256 hex string

# Load or create a cache
cache = FingerprintCache(Path(".forge-cache/fingerprints.json"))
cached_hash = cache.get(Path("textures/brick.png"))  # str | None
cache.set(Path("textures/brick.png"), digest)
cache.save()  # persist to disk

# Scan a directory
files: list[ScannedFile] = scan(
    source_dir=Path("assets/raw"),
    supported_extensions={".png", ".jpg", ".obj", ".gltf"},
    cache=cache,
)

# Each ScannedFile has:
for f in files:
    f.path         # Path — absolute path
    f.relative     # Path — relative to source_dir
    f.extension    # str — lowercase with dot
    f.fingerprint  # str — SHA-256 hex
    f.status       # FileStatus.NEW | CHANGED | UNCHANGED

Why content hashes, not timestamps:

  • Deterministic — same bytes always produce the same hash
  • Portable — survives git clone, file copies, CI
  • Correct — touching a file without changing content skips reprocessing

bundler.py — Asset bundles

python
from pipeline.bundler import (
    BundleWriter, BundleReader, BundleManifest, BundleEntry,
    DependencyGraph, create_bundle, BundleError, BundleFormatError,
)

# Write a bundle
writer = BundleWriter(Path("game.forgepak"), compression_level=3)
writer.add("textures/brick.png", png_bytes)
writer.add_file(Path("hero.fmesh"), "meshes/hero.fmesh",
                dependencies=["textures/brick.png"])
manifest = writer.finalize()

# Read a bundle (random access)
with BundleReader(Path("game.forgepak")) as reader:
    data = reader.read("textures/brick.png")
    paths = reader.manifest.paths
    entry = reader.manifest.get("meshes/hero.fmesh")

# Bundle an entire directory
manifest = create_bundle(
    output_dir=Path("assets/processed"),
    bundle_path=Path("game.forgepak"),
    compress=True,
    compression_level=3,
    patterns=["*.png", "*.fmesh"],  # optional glob filters
)

# Dependency graph (from .meta.json sidecars)
graph = DependencyGraph.from_meta_files(Path("assets/processed"))
deps = graph.dependencies_of("meshes/hero.fmesh")
dependents = graph.dependents_of("textures/brick.png")
order = graph.topological_order()

Bundle format (.forgepak):

  • Header (24 bytes): magic FPAK, version, entry count, TOC offset/size
  • Entry data: each entry compressed independently with zstd
  • TOC at end: zstd-compressed JSON array of entry metadata
  • O(1) random access — seek to offset, decompress one entry

Built-in plugins

TexturePlugin (plugins/texture.py)

Handles: .png, .jpg, .jpeg, .tga, .bmp

Processing steps:

  1. Load with Pillow, convert to RGB/RGBA
  2. Resize to fit max_size (preserves aspect ratio)
  3. Save in output_format (png, jpg, bmp)
  4. Generate mipmap chain (halved sizes down to 1x1)
  5. Optional GPU compression via basisu (KTX2) or astcenc (ASTC)
  6. Write .meta.json sidecar

Settings ([texture] in pipeline.toml):

SettingDefaultDescription
max_size2048Clamp width/height
generate_mipmapstrueCreate mip chain
output_format"png"Output format
jpg_quality90JPEG quality (1-100)
compression"none"none, basisu, astc
basisu_format"uastc"etc1s or uastc
basisu_quality1281-255
astc_block_size"6x6"4x4, 5x5, 6x6, 8x8
astc_quality"medium"fastest..exhaustive
normal_mapfalseBC5/linear encoding

MeshPlugin (plugins/mesh.py)

Handles: .obj, .gltf, .glb

Invokes forge-mesh-tool (compiled C binary) as a subprocess for:

  1. Vertex deduplication
  2. Index/vertex cache optimization (meshoptimizer)
  3. MikkTSpace tangent generation
  4. LOD simplification at configurable ratios

Output: .fmesh binary + .meta.json + optional .fmat material sidecar

Settings ([mesh] in pipeline.toml):

SettingDefaultDescription
deduplicatetrueRemove duplicate vertices
optimizetrueCache-friendly index reorder
generate_tangentstrueMikkTSpace tangent frames
lod_levels[1.0]Target triangle ratios
tool_path""Override tool location

Falls back gracefully if the C tool is not installed.

AnimationPlugin (plugins/animation.py)

Handles: .gltf, .glb

Invokes forge-anim-tool (compiled C binary) to extract glTF animation clips into .fanim binary files with channels, samplers, and keyframe data.

Settings ([animation] in pipeline.toml):

SettingDefaultDescription
tool_path""Override tool location

Multiple plugins can handle the same extension — both MeshPlugin and AnimationPlugin register .gltf/.glb, so a single glTF file produces both a .fmesh and a .fanim.

CLI usage

bash
# Scan and process all assets (uses pipeline.toml or defaults)
forge-pipeline

# Dry run — scan and report without processing
forge-pipeline --dry-run

# Verbose output
forge-pipeline -v

# Custom config file
forge-pipeline -c my-config.toml

# Override source directory
forge-pipeline --source-dir path/to/assets

# Process only one plugin type
forge-pipeline --plugin texture

# Bundle processed assets
forge-pipeline bundle
forge-pipeline bundle -o game.forgepak --level 9
forge-pipeline bundle --pattern "*.png" --pattern "*.fmesh"

# Inspect a bundle
forge-pipeline info game.forgepak

Writing a new plugin

  1. Create pipeline/plugins/my_type.py
  2. Subclass AssetPlugin, set name and extensions
  3. Implement process() returning an AssetResult
  4. Add a [my_type] section to pipeline.toml for settings
  5. Add tests in tests/pipeline/test_my_type.py
python
"""My custom asset type plugin."""
from pathlib import Path
from pipeline.plugin import AssetPlugin, AssetResult

class MyTypePlugin(AssetPlugin):
    name = "my_type"
    extensions = [".xyz"]

    def process(self, source: Path, output_dir: Path, settings: dict) -> AssetResult:
        threshold = int(settings.get("threshold", 100))
        output = output_dir / f"{source.stem}.processed"
        # ... transform source into output ...
        return AssetResult(
            source=source,
            output=output,
            metadata={"threshold": threshold, "processed": True},
        )

The plugin is auto-discovered — no registration code needed.

Settings-aware caching

The pipeline combines each file's content hash with a digest of its plugin settings. Changing a setting (e.g. max_size from 2048 to 1024) invalidates previously processed assets even if the source file hasn't changed.

python
# From __main__.py — the combined fingerprint
combined = sha256(f"{content_hash}:{json.dumps(settings, sort_keys=True)}")

Metadata sidecars

Every plugin writes a .meta.json file alongside its output. Sidecars record the source file, output dimensions, processing settings, and dependency information. The bundler reads these to build the dependency graph for correct processing order and invalidation.

Testing

bash
# Run all pipeline tests
uv run pytest tests/pipeline/ -v

# Run a specific test module
uv run pytest tests/pipeline/test_scanner.py -v

# Lint
uv run ruff check pipeline/ tests/pipeline/
uv run ruff format --check pipeline/ tests/pipeline/

Common mistakes

MistakeFix
Using timestamps for change detectionUse SHA-256 content hashes — timestamps break on git clone
Hardcoding plugin list in core codeUse file-based discovery — drop a .py file to add a type
Storing absolute paths in the cacheUse POSIX-style relative paths for portability
Not validating plugin registrationCheck for duplicate names — silent conflicts cause confusion
Forgetting tomllib fallback for Python < 3.11Guard with sys.version_info, fall back to tomli
Skipping _-prefixed plugin filesConvention: _-prefixed files are internal helpers
Not writing .meta.json sidecarsBundler needs them for dependency graph construction
Single Write call for large filesUse chunked-write pattern for files over 800 lines

Cross-references

LessonWhat it covers
Asset 01 — Pipeline ScaffoldCLI, config, scanner, plugin system
Asset 02 — Texture ProcessingTexturePlugin, mipmaps, GPU compression
Asset 03 — Mesh ProcessingMeshPlugin, meshoptimizer, MikkTSpace
Asset 04 — Procedural Geometryforge_shapes.h C library
Asset 05 — Asset BundlesBundleWriter/Reader, .forgepak format
Asset 06 — Loading Processed AssetsC-side .fmesh/.meta.json loading
Asset 07 — Materials.fmat material sidecars, PBR pipeline
Asset 08 — AnimationsAnimationPlugin, .fanim binary format
GPU Lesson 05 — MipmapsHow GPU uses mip chains
GPU Lesson 17 — Normal MapsTangent space in shaders
GPU Lesson 39 — Pipeline AssetsLoading .fmesh in GPU code

Câu hỏi thường gặp

Kỹ năng AI Forge Pipeline Library làm được gì?

Sử dụng thư viện pipeline tài nguyên forge-gpu — gói Python được cài qua uv — để quét, tạo dấu vân tay, xử lý và đóng gói tài nguyên game bằng kiến trúc plugin. Dùng khi làm việc với mã pipeline, viết plugin, xử lý texture/mesh/animation, đóng gói tài nguyên hoặc mở rộng CLI của pipeline.

Vì sao nên dùng Forge Pipeline Library trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Forge Pipeline Library là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Forge Pipeline Library trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-pipeline-library. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Forge Pipeline Library?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Forge Pipeline Library với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Forge Pipeline Library với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Forge Pipeline Library có miễn phí không?

Có. Kỹ năng này được Nebulavenus phát hành trên GitHub theo giấy phép Zlib. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇