Bootstrap design spec · 2026-07-11

The System

General-purpose, spec-driven project governance and agent workflow for Pi.

Goal

Replace the super extension with the-system.

Combine its task branches, browser mockups, and workflow skills with a project-local source-of-truth system, guarded ownership, rich authored documents, and thin lifecycle prompts.

Outcome: agents know why a project exists, how work must be done, what behavior is approved, which implementation unit is active, and where defects are remembered—without duplicating authority.

Non-goals

  • No compatibility alias for super.
  • No project-specific product, provider, database, media, or deployment rules.
  • No generic research prompt.
  • No Git sync prompt.
  • No automatic generation of project laws without human dialogue.
  • No automatic browser or editor opening.
  • No document build pipeline, frontend framework, diagram dependency, or remote runtime asset.

Principles

  • One owner per fact.
  • Mission defines why. Rules define how. Specs define what.
  • Specs are leaf truth. Other system documents and tests point toward specs.
  • Spec-owned mockups are constituent assets, not external dependencies.
  • Simple data, direct flow, low complexity, and fail-fast errors are defaults.
  • Human-owned truth changes only through explicit human decisions.
  • Agent-owned memory remains structured, validated, terse, and disposable when superseded.
  • Tests prove behavioral and documentation contracts.
  • Invalid state is blocked or reported; it is never silently normalized.

Rename

BeforeAfter
extensions/superextensions/the-system
@bugabinga/pi-ext-super@bugabinga/pi-ext-the-system
super brandingThe System branding

Retain existing task commands, push-task, mockup, message rendering, and workflow skill names.

Update live package manifests, lockfile entries, static checks, TypeScript configuration, tests, README content, and current examples.

Leave historical docs/super/** documents unchanged.

Project root

The extension resolves one project root for injection, validation, and paths.

  1. Walk from ctx.cwd toward the filesystem root.
  2. Recognize a JJ workspace by its nearest .jj marker.
  3. Recognize a Git repository or worktree by its nearest .git directory or file.
  4. Use a colocated JJ/Git root when both markers resolve to the same directory.
  5. Fail when JJ and Git roots differ.
  6. Use ctx.cwd when no VCS marker exists.

A simple Git repository stores .system at its repository root.

A Git worktree stores and versions .system inside that worktree; shared Git metadata is never treated as project content.

A JJ workspace stores .system at its workspace root.

Filesystem

.system/
├── config.json
├── system.css
├── SYSTEM.md
├── MISSION.md
├── RULES.md
├── specs/
├── roadmaps/
├── plans/
├── issues/
└── research/
PathOwnerFormatPurpose
SYSTEM.mdHumanMarkdownDocument topology, ownership, and reference law.
MISSION.mdHumanMarkdownProject purpose, audience, outcomes, and boundaries.
RULES.mdHumanMarkdownProject-specific engineering and operating constraints.
specs/*.htmlHumanHTMLApproved behavior and design truth.
roadmaps/*.htmlAgent with human reviewHTMLOrdered phases for oversized specs.
plans/*.htmlAgent with human reviewHTMLExecutable implementation steps for one spec or roadmap phase.
issues/*.htmlAgentHTMLDefect memory: repro, cause, evidence, and intended fix.
research/*.htmlAgentHTMLFetched or experimental knowledge cache.
config.jsonThe SystemJSONPrefix and schema/style versions.
system.cssThe SystemCSSShared visual language.

Configuration

{
  "prefix": "PX",
  "schemaVersion": 1,
  "styleVersion": 1
}

The project prefix is required after initialization.

It must match [A-Z][A-Z0-9]{1,7}.

Initialization proposes a prefix from repository or project naming, then asks the human to approve or replace it.

Slugs must match [a-z0-9]+(?:-[a-z0-9]+)*.

IDs use independent sequences per type.

The numeric segment starts at three digits and grows naturally beyond 999.

Deleted IDs are never reused.

PX-SPEC-001-slug.html
PX-ROADMAP-001-slug.html
PX-PLAN-001-slug.html
PX-ISSUE-001-slug.html
PX-RESEARCH-001-slug.html

Core injection and ownership

Before each agent turn, append existing SYSTEM.md, MISSION.md, and RULES.md to the system prompt under explicit headings.

Missing core files do not receive invented defaults.

Existing core files are read-only to agent write, edit, and recognizable shell-write paths.

Missing core files may be created once by the initialization workflow after the user approves their drafts.

New specs and new spec-owned mockup assets may be created after conversational approval without a redundant UI gate.

Edits to existing specs or existing spec-owned mockup assets require interactive UI approval.

The gate is a safety net, not a security boundary.

Initialization

/system-init [PROJECT-PREFIX] is a thin prompt that requires the the-system-init skill.

The skill:

  1. Resolves and reports the project root.
  2. Inspects existing README, agent instructions, build files, tests, and project structure.
  3. Reads existing .system files without overwriting human-owned content.
  4. Asks one focused question at a time about purpose, audience, non-goals, engineering constraints, security, data, tests, and release expectations.
  5. Proposes the project prefix when absent.
  6. Drafts minimal MISSION.md, RULES.md, and canonical SYSTEM.md.
  7. Gets explicit human approval before writing each missing core file.
  8. Creates missing directories and config.json.
  9. Copies the current bundled system.css.
  10. Validates the completed system.

Rerunning initialization is idempotent.

It never overwrites existing core files.

It upgrades machine-owned config and CSS only after reporting the changes.

Startup compares installed schema/style versions with project config.

Outdated or incomplete projects receive one concise notification directing the user to /system-init.

Document graph

ArtifactRoleRelationship
MISSIONWhy the project exists.Independent core law.
RULESHow work must be done.Independent core law.
SPECWhat behavior is approved.Leaf truth; references no other system document.
ROADMAPSequences delivery of one oversized spec.Names its single parent spec.
PLANDefines executable implementation steps.Names one spec and, when applicable, one phase in that spec’s roadmap.
ISSUERecords a defect.Names the specs whose contracts are violated.
TESTProves behavior.Names the specs whose contracts it verifies.

Specs do not reference roadmaps, plans, issues, research, or tests.

A spec may link adjacent mockup files that are owned as part of that spec.

Deleting, renaming, or editing a spec therefore exposes every dependent reference without creating cycles.

HTML source contract

  • Documents are complete HTML files with doctype, language, UTF-8 charset, viewport metadata, title, and ../system.css.
  • Source uses semantic elements: header, main, section, headings, paragraphs, lists, tables, aside, figure, and details.
  • Generic wrappers exist only when a layout cannot be expressed semantically.
  • Source is formatted, unminified, and directly editable.
  • One sentence per line remains preferred for prose.
  • Inline CSS may implement document-specific layouts or visual explanations.
  • Inline CSS cannot redefine Nugu colors, shared typography, shared breakpoints, or core components.
  • Compact hand-authored inline SVG is allowed when relationships cannot be explained clearly with HTML boxes, lists, tables, or text.
  • Generated SVG sludge and diagram libraries are forbidden.
  • Inline JavaScript is optional, dependency-free, and limited to progressive disclosure, filtering, or tiny interactive explanations.
  • Documents remain complete and readable with JavaScript disabled.
  • JavaScript cannot use network requests, external dependencies, browser storage, or remote executable resources.
  • External script sources, iframes, objects, embeds, meta refresh, remote CSS imports, event-handler attributes, and executable URL schemes are rejected.
  • Remote HTTPS anchors are navigation, not runtime resources, and remain allowed.
  • The validator accepts the deliberately narrow authored subset described here and rejects ambiguous active markup.

Shared CSS

The bundled stylesheet owns the visual language and is copied to .system/system.css.

It uses the Nugu semantic palette.

prefers-color-scheme selects coherent light or dark surfaces; one mode never mixes inverted surfaces from the other.

It provides brutal borders, shadows, semantic dossier hierarchy, tables, contracts, callouts, flows, metadata, code, status, and document navigation.

It is mobile-first, avoids page-level horizontal scrolling, stacks sections at narrow widths, wraps diagrams, and preserves readable touch targets.

The accepted visual direction is a spec-owned asset:

Nugu semantic dossier mockup

Document metadata

Every authored document contains exactly one readable JSON block:

<script type="application/json" id="system-meta">
{
  "id": "PX-ISSUE-001",
  "type": "issue",
  "status": "open",
  "specs": ["PX-SPEC-003"]
}
</script>

Metadata keys are exact; unknown keys fail validation.

TypeRequired metadata
Specid, type: "spec"
Roadmapid, type: "roadmap", one spec ID
Planid, type: "plan", one spec ID, optional roadmap ID and positive integer phase
Issueid, type: "issue", open|fixed status, unique specs array; the array may be empty while the violated contract is unknown
Researchid, type: "research", ISO capture date, optional unique HTTPS source URLs

Specs contain no status and no outgoing system-document metadata.

Metadata is the reference authority; validators never infer references from prose.

Normal HTTPS anchor links are allowed for human navigation and research citations.

Validators reject malformed or duplicate metadata blocks, duplicate JSON keys, duplicate IDs, filename/ID mismatch, invalid statuses, and unsupported types.

Dangling metadata references are reported by system diagnostics.

Tests reference specs with a language-appropriate comment containing SYSTEM-SPEC: PX-SPEC-001.

Doctor reports discovered test references when test roots are conventional, but missing test references remain a review contract rather than a universal filesystem rule.

Lifecycle prompts and skills

PromptSkillContract
/system-init [PREFIX]the-system-initGuided project-system creation or machine-asset upgrade.
/system-doctorsystem-doctorRun deterministic validation and explain findings.
/system-spec <idea>brainstormingDesign, review, approve, and write one HTML spec.
/system-roadmap <SPEC-ID>writing-roadmapsSplit an oversized approved spec into ordered phases.
/system-plan <SPEC-ID|ROADMAP-PHASE>writing-plansWrite one executable HTML implementation plan.
/system-impl <PLAN-ID>executing-plansExecute an approved plan with tests and review checkpoints.
/system-issue <report>system-issuesTriage, deduplicate, and record a defect without fixing unless asked.

Prompt templates remain thin.

Workflow logic lives in skills.

A shared system-documents skill owns HTML, metadata, ID, reference, mockup, and browser-review rules.

The issue skill is general-purpose: inspect relevant logs, tests, runtime state, and existing issues; sanitize evidence; record repro, cause or unknowns, smallest next check, and intended fix.

No provider-specific research or Git sync prompt is included.

Browser review

After writing or materially editing an authored HTML document, the agent prints its exact path and asks whether to open it in the browser.

It does not open the browser or editor automatically.

If approved, a bundled cross-platform Node helper converts the local path to a file URL and tries the platform opener without a shell.

The helper is a skill script, not an always-visible tool.

The source path remains the editing interface.

System doctor

/system-doctor invokes a focused skill and deterministic validator script.

It reports:

  • missing core files or directories;
  • invalid or outdated config and CSS versions;
  • invalid HTML document shells;
  • metadata and filename mismatches;
  • duplicate IDs;
  • dangling references;
  • specs with forbidden outgoing system-document references;
  • orphaned spec-owned mockups;
  • forbidden external executable resources;
  • wrong stylesheet paths.

Doctor never mutates files.

Blocking write validation and doctor use the same validation module.

Extension structure

extensions/the-system/
├── index.ts
├── mockup.ts
├── system.ts
├── documents.ts
├── assets/system.css
├── prompts/
│   ├── system-init.md
│   ├── system-doctor.md
│   ├── system-spec.md
│   ├── system-roadmap.md
│   ├── system-plan.md
│   ├── system-impl.md
│   └── system-issue.md
├── scripts/open-document.mjs
├── scripts/doctor.mjs
├── skills/
│   ├── the-system-init/
│   ├── system-documents/
│   ├── system-doctor/
│   ├── system-issues/
│   └── existing workflow skills...
└── __tests__/

index.ts registers existing tasks/mockups and delegates governance registration to system.ts.

documents.ts contains pure root, metadata, ID, reference, and narrow authored-HTML validation logic shared by extension hooks and scripts.

Validation is structural lint for trusted project documents, not a browser sandbox or proof about arbitrary JavaScript.

Node standard library remains sufficient.

Behavioral contracts

ContractProof
Simple Git, Git worktree, JJ, colocated, conflict, and no-VCS roots resolve correctly.extensions/the-system/__tests__/documents.test.ts
Core Markdown injects in stable SYSTEM/MISSION/RULES order.extensions/the-system/__tests__/system.test.ts
Existing core edits block; missing-core creation passes.extensions/the-system/__tests__/system.test.ts
New specs/assets pass; edits to existing specs/assets require UI approval.extensions/the-system/__tests__/system.test.ts
Metadata, IDs, filenames, references, HTML shell, CSS link, and forbidden resources validate.extensions/the-system/__tests__/documents.test.ts
Doctor reports without mutation.extensions/the-system/__tests__/doctor.test.ts
Initialization is guided, approval-bound, root-aware, idempotent, and core-preserving.extensions/the-system/__tests__/workflow-skills.test.ts
Lifecycle prompts are exported and delegate to the named skills.extensions/the-system/__tests__/workflow-skills.test.ts
Shared CSS contains exact Nugu light/dark tokens and responsive contracts.extensions/the-system/__tests__/documents.test.ts
Existing task branch and mockup behavior survives the hard rename.extensions/the-system/__tests__/super.test.ts and mockup.test.ts
Package manifests and static tooling contain no live extensions/super references.scripts/test_extensions_static_check.mjs

Migration

  1. Rename the extension directory and package.
  2. Keep task/mockup implementation behavior stable.
  3. Add governance, document validation, Nugu CSS, scripts, skills, and prompts.
  4. Convert workflow outputs from Markdown paths to project-local HTML paths.
  5. Update accepted mockup persistence to produce spec-owned adjacent HTML assets and HTML links.
  6. Export prompts and renamed skills from root package resources.
  7. Update live references and regenerate the lockfile through the existing mise/npm workflow.
  8. Run focused tests, real extension loading, static checks, and mise run ci.

Existing user filters or paths naming extensions/super break intentionally.

No migration shim, alias, duplicate package, or deprecated path remains.

Security and failure policy

  • Resolve and normalize every governed path before ownership checks.
  • Reject traversal outside the resolved project root.
  • Treat approval hooks and active-markup lint as advisory safeguards, not sandboxing.
  • Project core files are privileged instructions; initialization must explain this trust boundary before writing them.
  • Never execute authored document JavaScript during validation.
  • Never fetch document resources during validation or doctor runs.
  • Never place secrets, raw private data, or binary asset bytes in system documents.
  • Fail on ambiguous roots, malformed machine state, duplicate IDs, and invalid required metadata.
  • Report dangling references and upgrade availability without silent repair.
  • Preserve unrelated dirty work.