brandspec
brandspec separates conceptual direction (authored as a declarative JSON specification) from geometric execution (compiled with exact Bezier booleans, symmetry, and optical normalization).
Given the same spec.json, brandspec produces a byte-identical monochrome SVG, a 4-panel PNG inspection sheet, and deterministic raster quality metrics with zero headless browser dependencies.
Architecture
- Core Geometry (
core/): Resolves centeredsquare,isometric(30-degree axial), andpolargrids, builds continuousgrid_pathpolylines with exact cubic Bezier corner fillets, applies symmetry, and computes outwardhalooffsets viaskia-pathops. - Mark Engine (
engines/mark/): Compiles constructive primitives (grid_path,arc_band,circle,ring,rect,polygon) and parametric optical effects (line_screen,radial_blades,halftone_grid) withclip_tomasks,halo, and scopedhalo_targets. - Visual Inspection (
inspect/): Rasterizes viaresvg-pyto render a 4-panelsheet.pngand computesmetrics.jsonchecks vianumpyandpillow. - Expandable Engine Layout: Designed so future engines (
wordmark,lockup,icons,pattern,kit,tokens) and an interactive localhost review surface can plug into the same core andspec.jsonloop.
Project Layout
brandspec/
├── .github/workflows/
│ ├── ci.yml # Pytest and wheel build checks
│ └── publish.yml # PyPI Trusted Publishing on v* tags
├── LICENSE # GNU General Public License v3.0
├── pyproject.toml
├── skills/brandspec/SKILL.md # Agent workflow and DSL guide
├── samples/ # Reference brand mark specs
│ ├── kronos-chambers.json
│ ├── solaris-aperture.json
│ └── vela-sails.json
├── src/brandspec/
│ ├── cli.py # CLI commands: archetypes, init, build, check
│ ├── core/ # Shared grid, path, fillet, and symmetry helpers
│ ├── engines/mark/ # Geometric and optical mark compiler + archetypes
│ └── inspect/ # 4-panel sheet.png renderer and metrics gate
└── tests/
└── test_compiler.py
Installation and Usage
Requires Python 3.11 to 3.13 and uv.
Install the CLI globally from GitHub (or PyPI once published):
uv tool install git+https://github.com/rafifmsn/brandspec
brandspec archetypes
Or run directly in one command with uvx:
uvx --from git+https://github.com/rafifmsn/brandspec brandspec archetypes
Or run locally from a clone:
uv sync --extra dev
uv run brandspec archetypes
uv run brandspec init ribbon-weave --out spec.json
uv run brandspec build spec.json --out-dir out/ribbon-weave
uv run brandspec check spec.json
Install the bundled agent skill:
npx skills add rafifmsn/brandspec
CLI Commands
| Command | Description |
|---|---|
brandspec archetypes |
Lists all bundled mark starter templates. |
brandspec init <archetype> --out <path> |
Copies a bundled archetype spec to a working spec.json. |
brandspec build <spec.json> [--out-dir <dir>] [--strict] |
Compiles logo.svg, sheet.png, metrics.json, and locked spec.json. Exits with code 2 under --strict if any quality warning triggers. |
brandspec check <spec.json> |
Validates the schema and prints metrics.json without writing output files. |
Design Specification (spec.json)
All coordinates, widths, and clearances are expressed in multiples of unit on a centered grid origin (0, 0).
Grids
square:[x, y]in grid units (+xright,+ydown).isometric:[q, r]30-degree axial coordinates ((1, 0)down-right 30 deg,(0, 1)straight down,(1, -1)up-right 30 deg).polar:[ring, angle_deg](0deg at 12 o'clock, increasing clockwise).
Shapes
grid_path: Continuous open or closed polyline through grid points with optionalwidth(0for filled polygon),corner_radius,cap(butt,round,square), andjoin(miter,round,bevel).arc_band: Circular arc or filled pie wedge defined bycenter,radius,start_deg,end_deg,width, andfill_sector.circle,ring,rect,polygon: Standard geometric primitives with optionalangle_degandcorner_radius.line_screen: Parallel stripes modulated byconstant,linear,center_bulge,center_pinch,sine, orexponentialthickness profiles.radial_blades: N-fold twisted curved blades arranged radially around a center.halftone_grid: Grid ofcircle,square, ordiamondcells scaled byradial_decay,radial_grow,linear_x,linear_y,diagonal, orsine_ripple.
Layered Booleans, halo, and halo_targets
Each entry in layers supports op (unite, subtract, intersect, xor), optional clip_to silhouette masks, and optional per-layer symmetry (none, mirror_x, mirror_y, mirror_xy, rotate, glide_x).
Setting "halo": 0.38 on a unite layer automatically dilates that layer outward and subtracts the clearance gap from earlier layers before uniting.
To weave bands over and under each other without cutting earlier segments of the same band, set "halo_targets": ["<crossing-layer-id>"] so the clearance carve applies only to the specified target layers.
Visual Audit and Metrics Gate
Every brandspec build outputs:
logo.svg: Flattened single-path monochrome vector normalized to1000x1000.sheet.png: 4-panel visual sheet showing (1) the construction grid overlay, (2) 400px positive render, (3) 400px inverted render, and (4) 96px, 48px, and 24px positive/inverted scale tests.metrics.json: Automated checks coveringink_ratio(target0.16to0.72),ink_ratio_24px(0.06to0.74),bbox_aspect(<= 2.6),island_count,tiny_island_count(0tolerated), andoptical_drift_pct.spec.json: Locked specification for deterministic reproduction.
Bundled Archetypes and Samples
| Recipe | Category | Grid | Focus |
|---|---|---|---|
ribbon-weave |
geometric |
square |
Interlocking stadium links using halo and halo_targets |
iso-impossible |
geometric |
isometric |
Three-fold rotational folded hexagon |
line-screen-disc |
effect |
square |
Linearly modulated stripes clipped to a sphere with diagonal cut |
radial-vortex |
effect |
polar |
Six-blade twisted optical aperture |
stencil-monogram |
monogram |
square |
Modular figure-ground letterform with rounded arches |
samples/vela-sails.json |
effect |
square |
Concave curved sails over a modulated stripe hull |
samples/solaris-aperture.json |
effect |
polar |
Eight-blade kinetic core inside a segmented corona ring |
samples/kronos-chambers.json |
geometric |
square |
Four-way interlocking acoustic chambers around a central core |
Development
uv run pytest -v
uv build
License
GNU General Public License v3.0 (LICENSE).
Metadata
Release files for brandspec 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| brandspec-0.1.0.tar.gz | 162.5 kB | With provenance | Details for brandspec-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| brandspec-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for brandspec-0.1.0-py3-none-any.whl |
Total release size: 199.9 kB
Release files / brandspec-0.1.0.tar.gz
| Download URL | brandspec-0.1.0.tar.gz |
|---|---|
| Size | 162.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55bdc5b92b1a9319ed96a8fb500e32affb5f66b131bc4585bb57249fbc4ef672
|
|
BLAKE2b-256 checksum How to use checksums |
68607e197ec8eec25d6a8ab8d680127768947445727e9d7a74d43ed031b8df3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / brandspec-0.1.0-py3-none-any.whl
| Download URL | brandspec-0.1.0-py3-none-any.whl |
|---|---|
| Size | 37.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f73c8b7b9b42f7ec03710e34c538a2b6ddbf82cdceb176b95614d907c9693f3
|
|
BLAKE2b-256 checksum How to use checksums |
184784e62d18c1594a613a004d8da063ae8ad52e3d4c5966e8c6eb0f88447f28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for brandspec 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for brandspec-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.