Skip to content

Stack Packs ​

Stack packs declare stack detection, tooling and project preparation without framework-specific core changes. Use this contract when contributing a pack or a trusted project overlay.

Contribution ​

devkit maint stack-new <id> [dir] drafts a pack. Ship assets and fixtures; pass devkit maint rust-only and review.

Manifest ​

Required: {schema:1,id,kind:"stack",core_api:1,exports}; kebab-case id. Unknown fields/versions, missing/escaping assets reject.

json
json
{
  "schema": 1,
  "id": "example",
  "kind": "stack",
  "core_api": 1,
  "exports": {
    "detection": {"priority": 85, "when": {"file_exists": "example.config.*"}},
    "index": {"graph":{"driver":"driver/graph.mjs","output":"graph.json","sources":{"extensions":[".js"]}}},
    "prepare": [{"when":{"file_exists":"package.json"},"exec":"package","args":["example","sync"]},{"when":{"file_exists":"example"},"exec":"copy_if_missing","args":[".env.example",".env"]}],
    "test_probe": {"when":{"dir_exists":"vendor"},"exec":"php","args":["example","db:show"]},
    "design_fill": {},
    "rules": {"example": {"globs": ["src/**/*.rs"], "fragments": ["Example"]}}
  }
}
ExportRead byMeaning
toolssync/init/doctorunique [a-z0-9-]+ registry names, tier: pack
detection (required)detect-stackwhen selects profile; lower priority first; fallback: true runs after direct subdirectories
context_bundlesindex-prepdirectory or {pack,path}: STACK.md, CONVENTIONS.md, DESIGN.delta
context_fillindex-prepglobal integrations: [{dep,label,manifest?}] (default package.json), hosting: [{file,line}]; STACK.md sections
indexindex-prep, graph-refreshgraph: {driver, output, sources: {dirs?, extensions}}; output is graph.json or liquid-graph.json, dirs default to ["."]
source_hintswalksglobal json_header_globs: comment headers; source_extensions: token-scan inputs
languagesstructure/routing/lint/reuse/reviewglobal language metadata below
browserbrowser/design driversglobal design_sections: page selectors
design_adapterpen-design, design compare/verify{stack,reference?,dev_url}: DESIGN.md stack, adapter, fallback URL
reviewspec-review stack lensfile extensions a diff must touch for the lens
architecturearch-prep, stack lens{stack_check, scope_extensions}
gatesdevkit gate list, devkit gate run <id> [files…]definitions or {pack, path} naming a JSON array of definitions
preparedevkit stack-prepare [dir], wave, delegatestandalone command runs due package steps only (default .); wave/delegate also run copy_if_missing, php and program bootstrap steps after installs
testtest-prep, index-preprunners, narrowing, evidence, E2E; central only
installwave, delegateattempts, readiness, lockfiles, origin links; central only
test_probetest-prepDB observations
plugin_seedproject-migrateprofile's .claude/settings.json merge seed
retired_skillsskills pullremove previously linked legacy skills
design_fillDESIGN.mdUI libraries before core rows; token configs
design_inventory_starterdesign inventory --init, index-prepstarter recipe
design_declarationdesign inventory, design sheet-fill icons{driver, aliases?, icon_extensions?} parser; icon_extensions files answer op: "icons"
componentsdesign component-registry{driver} module

Assets: relative or {pack,path}. pack skips global install/preflight; OD_SKIP_TOOLS_RECONCILE=1 skips installation.

Rule metadata ​

rules: lowercase kebab-case basenames (no .md) → required globs/fragments string arrays; either empty, not both; order retained. Globs: nonempty relative patterns; no empty, . or .. components, backslashes or controls; opaque syntax. Fragments: nonblank inline Markdown without NUL. Unknown fields/wrong types reject. Missing rules: empty; rendering/cross-pack merging deferred.

Language metadata ​

languages: {family: {extensions, globs?, declaration?, dod_tools?}} unions packs/libraries.json; duplicate suffixes reject order-independently. blade.php also matches php.

extensions: {suffix: {roles, jscpd?}} declares source/module/comment/design/clone/hook_clone/tree/reuse roles. globs: reuse/placement/endpoint arrays; declaration: regex, extract/impact_extract tuples, keywords, mandated_prefix; dod_tools: DoD substrings.

Graph drivers ​

.mjs stdin {protocol: 1, op: "graph", app_root, output, generated_dirs, cache: {graph, mtimes}} → stdout {protocol: 1, text: string | null, cache?, log: string[]}. No writes/spawns; invalid cache rebuilds; null text skips publication.

devkit graph-refresh [dir] [--force] runs the pack's graph driver and publishes the validated graph atomically; it is not a gate run gate. Without a directory it uses CLAUDE_PROJECT_DIR, then the working directory. Small themes can bypass detection thresholds when exactly one graph driver matches their source directories.

Shared graph-manifest.json graph_source_hash and graph-build-cache.json: single output, no per-output caches. Profile/output switches invalidate mismatches: reuse checks graph and driver/config hashes; skipping checks source hash too.

Inventory declaration drivers ​

.mjs stdin {protocol: 1, op: "declarations", files: [{file, text}]} → stdout {protocol: 1, declarations: [{name, props, blocks}]} in input order. One bounded read-only call per glob source; host validates count/types, hashes driver/sources; failures preserve inventory. Recipes: pack id as declaration; aliases preserves legacy recipes.

Invocations ​

{when, exec, args, env?}: exec is package, php or copy_if_missing; alternatively supply program: "<executable>" and omit exec. package uses the package manager; php and program run through the bounded runner in project cwd. copy_if_missing copies project-relative [from,to] without overwriting; predicates are evaluated before execution.

Gates and overlays ​

{id,when?,program?|driver?|exec?,args,extensions,findings_exit,baseline?}: one executor; exec: "package" locks the package manager. {files} filters paths; empty passes except whole_project/lint args_all. baseline: {file,generate_args}, {baseline}: atomic HEAD baseline (project if unborn), vendor link/state writes. Output GATE <id> <pass|findings|unavailable|error> files=<n> exit=<raw>; missing program: unavailable/127.

Lint: role: "lint"; first available configs/requires wins. when filters contents; requires_script checks package.json. args_all/args_files, {manifest}, ignored_marker/config_error_markers, rtk_mode (none disables). Repo clippy requires trusted .agents/stacks/node/extension.json.

Drivers: .mjs {pack,path}, stdin {root,args,files} → {status,exit,lines,inherited}; malformed/crashed responses fail closed. stdout/stderr preserve UTF-8 passthrough without GATE lines. inherit_env extends runner env; quality_gate retains affected-map routing. Fallow dead-code is packed; audit stays core.

Use devkit gate list to inspect the matched pack's gates; devkit gate run liquid-schema checks a Liquid theme's schema. Passthrough gates accept driver flags such as devkit gate run liquid-schema --path <theme>.

Post-edit gate edit: contract, safety, formatters.

Overlay: .agents/stacks/<matched-id>/extension.json, same schema/core_api/id, kind: "overlay", extends: "<matched-id>". Only noncolliding gates/prepare append; no symlinks or escaping assets.

Review before devkit stack trust [dir]: SHA-256 pins sorted length-framed paths/bytes per canonical project in $DEVKIT_HOME/stack-trust.json. Edits yield STACK_OVERLAY_UNTRUSTED. Definitions/drivers/{overlay} use this snapshot; trust permits execution, outside reads and network.

Predicates ​

  • all/any/not: combine predicates.
  • file_exists: project path; trailing * matches filename prefixes. dir_exists: project directory.
  • child_file_exists: direct-child filename; skips symlinks, hidden/vendored/generated/gitignored directories/files.
  • json_strings: structural string evidence.
  • json_key: {file, key}: JSON object contains key, regardless of value.
  • file_count: {dirs, suffix, min}: count at depth ≤3; . is project root; skips vendored/generated/gitignored directories.
  • dep_present: {manifest, name}: package.json dependencies or composer.json require/require-dev, not mentions/scripts.
  • file_contains/file_line_prefix (line-anchored): {file, text}.

Fill operations ​

text: literal line; dep_version: line with {version}; dep_present: line, optional unless_script. Both read manifest (default package.json or composer.json; dep_present works without package.json). ts_strict: line with {strict}; first_of: first nonempty operation; node_runtime: Node, package manager, optional package_manager_suffix; node_framework: true: module system, TypeScript strict/unset, runners; node_build: build scripts.

Integrations ​

Optional integrations have a separate, central-only catalog at content/integrations/<id>/extension.json. They are not stack packs, overlays or stack trust inputs. Their manifest uses schema: 1, kind: "integration", core_api: 1 and an id matching the directory. Unknown fields reject.

The four exports are commands (arrays of command-prefix words), skills (names under content/skills/), mcp (names in content/mcps.json) and present (project-relative literal files or one-level dir/*.suffix probes). Unsafe paths and missing skill/MCP references reject. Pen exports design, pen-mcp, pen-design, pencil, and probes design/AGENTS.md and design/*.pen.

Commit .agents/extensions.json to declare the project's choices:

json
json
{"schema": 1, "enabled": ["pen"]}

A declaration enables exactly the listed integrations; an empty list explicitly disables all of them. Without a declaration, presence enables the integration. Invalid, unreadable or non-regular declarations are errors; future gates must fail closed. Resolution uses only filesystem reads, not Git subprocesses. The nearest ancestor containing a .git file or directory owns the declaration, so linked worktrees and nested repositories keep their own choices.

  • devkit extension enable pen creates or updates the declaration.
  • devkit extension disable pen removes the id but keeps the declaration.
  • devkit extension status [pen] reports enablement, its source and exports.

Writes preserve other ids, sort and deduplicate them, refuse changed snapshots, and do nothing when the declaration already has the requested state. Slice 1 only provides this contract and CLI: design commands, hooks, skills and MCPs do not yet honor it. Slice 2 adds gates; skill/MCP projection follows separately.

Library tables ​

libraries.json: global integrations, ui_frameworks, codegraph_hints: {config_prefixes,package_mentions}. Rows {dep,label,manifest?} follow packs; mention:true matches quoted mentions.

Component driver ​

components.driver: bounded Node ES module; stdin {protocol: 1, repo_root, app_root, include_packages}, stdout {status, components, packages, unresolved_tags, inputs, diagnostics}. Status: complete, partial, error, missing_prerequisite. Inputs inside either root; no writes/spawns.

Runner limits ​

support::runner: cleared env (PATH, HOME, TMPDIR, LANG, LC_ALL, TERM plus declared variables), Seatbelt/macOS or bwrap/Linux, writes only in cwd/temp, process-tree deadline, output cap. Missing sandbox refuses execution; no unsandboxed fallback.

Linux requires Landlock ABI6 abstract Unix-socket scoping (Linux 6.12+ with Landlock enabled) and refuses before execution if scoping fails. Use unprivileged bubblewrap; setting no-new-privileges before execution prevents setuid privilege elevation. A host administrator may explicitly accept reachable host abstract sockets by setting DEVKIT_RUNNER_ALLOW_UNSCOPED_ABSTRACT_UNIX=1 in the host environment. This retains bwrap and emits RUNNER_ABSTRACT_UNIX_UNSCOPED when Landlock cannot scope the run; a pack's declared environment cannot opt in. Supported hosts retain TCP and sandbox-local Unix IPC.

Pathname Unix-socket protection is best-effort known-endpoint masking, not complete host IPC isolation. Linux shares host temporary directories to preserve temporary drivers, imports and outputs. It masks known SSH, Docker, runtime and Git credential-cache endpoints and sockets directly under /tmp at startup. Arbitrary nested sockets and host sockets created after discovery can remain reachable, including a previously absent SSH_AUTH_SOCK. This remains a HIGH isolation limitation pending private temporary storage with explicit caller binds.

Internal docs — onedot-devkit · devkit

devkitdevkit syncdevkit statusdevkit doctordevkit helpInternal docs · ONEDOT digital crew