repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

docs(super): design the-system

5c99033b3a9fd65d660715698f5e32a6f3692220

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (2)

+595 / −0 text lines

Diff layout

docs/super/specs/2026-07-11-the-system-design-mockup-nugu-unified-dossier.html

Added
new file mode 100644

+167 / −0 text lines

1<!doctype html>
2<html lang="en">
3<head>
4<meta charset="utf-8">
5<meta name="viewport" content="width=device-width, initial-scale=1">
6<title>Nugu semantic dossier</title>
7<style>
8:root {
9 color-scheme: light dark;
10 --fg: #121212;
11 --page: #ededed;
12 --panel: #dbdbdb;
13 --accent: #ae2eae;
14 --ui-accent: #922792;
15 --minor: #3b3b3b;
16 --focus: #184e5b;
17 --important: #4f3c69;
18 --error: #bd172e;
19 --warning: #6e6c10;
20 --info: #116477;
21 font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
22 color: var(--fg);
23 background: var(--page);
24}
25@media (prefers-color-scheme: dark) {
26 :root {
27 --fg: #ededed;
28 --page: #121212;
29 --panel: #242424;
30 --accent: #d151d1;
31 --ui-accent: #d86dd8;
32 --minor: #8b8b8b;
33 --focus: #7ba1aa;
34 --important: #dfd3f3;
35 --error: #ec6376;
36 --warning: #f0ee69;
37 --info: #3ec5e3;
38 }
39}
40* { box-sizing: border-box; }
41body { margin: 0; padding: 1rem; }
42.doc {
43 background: var(--page);
44 border: 3px solid var(--fg);
45 box-shadow: 9px 9px 0 var(--ui-accent);
46 max-width: 780px;
47 margin: 0 auto;
48}
49.mast {
50 display: grid;
51 grid-template-columns: minmax(0, 1fr) auto;
52 gap: 1rem;
53 padding: clamp(.85rem, 3vw, 1.3rem);
54 border-bottom: 3px solid var(--fg);
55 background: var(--panel);
56}
57.k {
58 font-size: .7rem;
59 font-weight: 900;
60 letter-spacing: .16em;
61 text-transform: uppercase;
62 color: var(--accent);
63}
64.mast h1 {
65 margin: .2rem 0 0;
66 font: 900 clamp(1.35rem, 5vw, 2.25rem)/.96 system-ui;
67 text-transform: uppercase;
68 overflow-wrap: anywhere;
69}
70.id {
71 border: 2px solid var(--fg);
72 padding: .45rem;
73 font-weight: 900;
74 align-self: start;
75 background: var(--page);
76}
77.grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
78.section {
79 padding: clamp(.8rem, 2vw, 1.1rem);
80 border-bottom: 2px solid var(--fg);
81 min-width: 0;
82}
83.section:nth-child(odd) { border-right: 2px solid var(--fg); }
84.section h2 {
85 font: 900 .76rem/1 system-ui;
86 text-transform: uppercase;
87 letter-spacing: .11em;
88 margin: 0 0 .75rem;
89 color: var(--accent);
90}
91.section p, .section li { font-size: .82rem; line-height: 1.55; }
92.contract {
93 background: var(--panel);
94 color: var(--fg);
95 padding: .8rem;
96 border: 2px solid var(--fg);
97 border-left: 7px solid var(--ui-accent);
98 font-weight: 800;
99}
100.flow { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
101.node {
102 border: 2px solid var(--fg);
103 padding: .35rem .5rem;
104 background: var(--panel);
105 font-weight: 900;
106}
107.arrow { font-size: 1.2rem; color: var(--accent); }
108.note {
109 border: 2px dashed var(--focus);
110 padding: .65rem;
111 color: var(--focus);
112 background: var(--panel);
113}
114@media (max-width: 560px) {
115 body { padding: .5rem; }
116 .doc { box-shadow: 5px 5px 0 var(--ui-accent); }
117 .mast { grid-template-columns: 1fr; }
118 .id { justify-self: start; }
119 .grid { grid-template-columns: 1fr; }
120 .section:nth-child(odd) { border-right: 0; }
121 .flow { align-items: stretch; }
122 .node { flex: 1; text-align: center; }
123 .arrow { align-self: center; }
124}
125</style>
126</head>
127<body>
128<article class="doc">
129<header class="mast">
130<div>
131<div class="k">The System · Spec 012</div>
132<h1>Trusted document graph</h1>
133</div>
134<div class="id">OPEN<br>2026-07-11</div>
135</header>
136<div class="grid">
137<section class="section">
138<h2>Problem</h2>
139<p>Project truth is scattered. Agents infer ownership, drift state, and bury decisions in prose.</p>
140</section>
141<section class="section">
142<h2>Decision</h2>
143<div class="contract">One owner per fact.<br>Invalid state fails loud.</div>
144</section>
145<section class="section">
146<h2>Behavior contracts</h2>
147<ol>
148<li>Specs remain human-owned.</li>
149<li>Issues point to specs.</li>
150<li>Tests prove contracts.</li>
151</ol>
152</section>
153<section class="section">
154<h2>Flow</h2>
155<div class="flow">
156<span class="node">MISSION</span>
157<b class="arrow">→</b>
158<span class="node">RULES</span>
159<b class="arrow">→</b>
160<span class="node">SPEC</span>
161</div>
162<p class="note">At narrow widths, sections stack and diagrams wrap without horizontal page scroll.</p>
163</section>
164</div>
165</article>
166</body>
167</html>

docs/super/specs/2026-07-11-the-system-design.html

Added
new file mode 100644

+428 / −0 text lines

1<!doctype html>
2<html lang="en">
3<head>
4<meta charset="utf-8">
5<meta name="viewport" content="width=device-width, initial-scale=1">
6<title>The System design</title>
7<style>
8:root {
9 color-scheme: light dark;
10 --fg: #121212;
11 --page: #ededed;
12 --panel: #dbdbdb;
13 --accent: #ae2eae;
14 --ui-accent: #922792;
15 --focus: #184e5b;
16}
17@media (prefers-color-scheme: dark) {
18 :root {
19 --fg: #ededed;
20 --page: #121212;
21 --panel: #242424;
22 --accent: #d151d1;
23 --ui-accent: #d86dd8;
24 --focus: #7ba1aa;
25 }
26}
27* { box-sizing: border-box; }
28body {
29 margin: 0;
30 background: var(--page);
31 color: var(--fg);
32 font: 15px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
33}
34article {
35 width: min(100% - 2rem, 980px);
36 margin: 1rem auto 3rem;
37 border: 3px solid var(--fg);
38 box-shadow: 9px 9px 0 var(--ui-accent);
39}
40header, section { padding: clamp(1rem, 3vw, 1.6rem); }
41header { background: var(--panel); border-bottom: 3px solid var(--fg); }
42h1 { margin: .2rem 0 0; font: 900 clamp(2rem, 7vw, 4rem)/.92 system-ui; text-transform: uppercase; }
43h2 { margin: 0 0 1rem; color: var(--accent); font: 900 1rem/1 system-ui; letter-spacing: .12em; text-transform: uppercase; }
44h3 { margin: 1.5rem 0 .5rem; font-size: 1rem; }
45p, li { max-width: 78ch; }
46section { border-bottom: 2px solid var(--fg); }
47code, pre { background: var(--panel); }
48code { padding: .12rem .3rem; }
49pre { overflow: auto; padding: 1rem; border-left: 6px solid var(--ui-accent); }
50table { width: 100%; border-collapse: collapse; }
51th, td { padding: .6rem; border: 2px solid var(--fg); text-align: left; vertical-align: top; }
52th { background: var(--panel); }
53a { color: var(--focus); font-weight: 800; }
54.contract { border: 2px solid var(--fg); border-left: 8px solid var(--ui-accent); background: var(--panel); padding: 1rem; }
55@media (max-width: 600px) {
56 article { width: calc(100% - 1rem); margin: .5rem; box-shadow: 5px 5px 0 var(--ui-accent); }
57 th, td { display: block; width: 100%; }
58 th { border-bottom: 0; }
59}
60</style>
61</head>
62<body>
63<article>
64<header>
65<p><strong>Bootstrap design spec · 2026-07-11</strong></p>
66<h1>The System</h1>
67<p>General-purpose, spec-driven project governance and agent workflow for Pi.</p>
68</header>
69<main>
70<section>
71<h2>Goal</h2>
72<p>Replace the <code>super</code> extension with <code>the-system</code>.</p>
73<p>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.</p>
74<div class="contract">
75<strong>Outcome:</strong> 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.
76</div>
77</section>
79<section>
80<h2>Non-goals</h2>
81<ul>
82<li>No compatibility alias for <code>super</code>.</li>
83<li>No project-specific product, provider, database, media, or deployment rules.</li>
84<li>No generic research prompt.</li>
85<li>No Git sync prompt.</li>
86<li>No automatic generation of project laws without human dialogue.</li>
87<li>No automatic browser or editor opening.</li>
88<li>No document build pipeline, frontend framework, diagram dependency, or remote runtime asset.</li>
89</ul>
90</section>
92<section>
93<h2>Principles</h2>
94<ul>
95<li>One owner per fact.</li>
96<li>Mission defines why. Rules define how. Specs define what.</li>
97<li>Specs are leaf truth. Other system documents and tests point toward specs.</li>
98<li>Spec-owned mockups are constituent assets, not external dependencies.</li>
99<li>Simple data, direct flow, low complexity, and fail-fast errors are defaults.</li>
100<li>Human-owned truth changes only through explicit human decisions.</li>
101<li>Agent-owned memory remains structured, validated, terse, and disposable when superseded.</li>
102<li>Tests prove behavioral and documentation contracts.</li>
103<li>Invalid state is blocked or reported; it is never silently normalized.</li>
104</ul>
105</section>
107<section>
108<h2>Rename</h2>
109<table>
110<tr><th>Before</th><th>After</th></tr>
111<tr><td><code>extensions/super</code></td><td><code>extensions/the-system</code></td></tr>
112<tr><td><code>@bugabinga/pi-ext-super</code></td><td><code>@bugabinga/pi-ext-the-system</code></td></tr>
113<tr><td>super branding</td><td>The System branding</td></tr>
114</table>
115<p>Retain existing task commands, <code>push-task</code>, <code>mockup</code>, message rendering, and workflow skill names.</p>
116<p>Update live package manifests, lockfile entries, static checks, TypeScript configuration, tests, README content, and current examples.</p>
117<p>Leave historical <code>docs/super/**</code> documents unchanged.</p>
118</section>
120<section>
121<h2>Project root</h2>
122<p>The extension resolves one project root for injection, validation, and paths.</p>
123<ol>
124<li>Walk from <code>ctx.cwd</code> toward the filesystem root.</li>
125<li>Recognize a JJ workspace by its nearest <code>.jj</code> marker.</li>
126<li>Recognize a Git repository or worktree by its nearest <code>.git</code> directory or file.</li>
127<li>Use a colocated JJ/Git root when both markers resolve to the same directory.</li>
128<li>Fail when JJ and Git roots differ.</li>
129<li>Use <code>ctx.cwd</code> when no VCS marker exists.</li>
130</ol>
131<p>A simple Git repository stores <code>.system</code> at its repository root.</p>
132<p>A Git worktree stores and versions <code>.system</code> inside that worktree; shared Git metadata is never treated as project content.</p>
133<p>A JJ workspace stores <code>.system</code> at its workspace root.</p>
134</section>
136<section>
137<h2>Filesystem</h2>
138<pre><code>.system/
139├── config.json
140├── system.css
141├── SYSTEM.md
142├── MISSION.md
143├── RULES.md
144├── specs/
145├── roadmaps/
146├── plans/
147├── issues/
148└── research/</code></pre>
149<table>
150<tr><th>Path</th><th>Owner</th><th>Format</th><th>Purpose</th></tr>
151<tr><td><code>SYSTEM.md</code></td><td>Human</td><td>Markdown</td><td>Document topology, ownership, and reference law.</td></tr>
152<tr><td><code>MISSION.md</code></td><td>Human</td><td>Markdown</td><td>Project purpose, audience, outcomes, and boundaries.</td></tr>
153<tr><td><code>RULES.md</code></td><td>Human</td><td>Markdown</td><td>Project-specific engineering and operating constraints.</td></tr>
154<tr><td><code>specs/*.html</code></td><td>Human</td><td>HTML</td><td>Approved behavior and design truth.</td></tr>
155<tr><td><code>roadmaps/*.html</code></td><td>Agent with human review</td><td>HTML</td><td>Ordered phases for oversized specs.</td></tr>
156<tr><td><code>plans/*.html</code></td><td>Agent with human review</td><td>HTML</td><td>Executable implementation steps for one spec or roadmap phase.</td></tr>
157<tr><td><code>issues/*.html</code></td><td>Agent</td><td>HTML</td><td>Defect memory: repro, cause, evidence, and intended fix.</td></tr>
158<tr><td><code>research/*.html</code></td><td>Agent</td><td>HTML</td><td>Fetched or experimental knowledge cache.</td></tr>
159<tr><td><code>config.json</code></td><td>The System</td><td>JSON</td><td>Prefix and schema/style versions.</td></tr>
160<tr><td><code>system.css</code></td><td>The System</td><td>CSS</td><td>Shared visual language.</td></tr>
161</table>
162</section>
164<section>
165<h2>Configuration</h2>
166<pre><code>{
167 "prefix": "PX",
168 "schemaVersion": 1,
169 "styleVersion": 1
170}</code></pre>
171<p>The project prefix is required after initialization.</p>
172<p>It must match <code>[A-Z][A-Z0-9]{1,7}</code>.</p>
173<p>Initialization proposes a prefix from repository or project naming, then asks the human to approve or replace it.</p>
174<p>Slugs must match <code>[a-z0-9]+(?:-[a-z0-9]+)*</code>.</p>
175<p>IDs use independent sequences per type.</p>
176<p>The numeric segment starts at three digits and grows naturally beyond 999.</p>
177<p>Deleted IDs are never reused.</p>
178<pre><code>PX-SPEC-001-slug.html
179PX-ROADMAP-001-slug.html
180PX-PLAN-001-slug.html
181PX-ISSUE-001-slug.html
182PX-RESEARCH-001-slug.html</code></pre>
183</section>
185<section>
186<h2>Core injection and ownership</h2>
187<p>Before each agent turn, append existing <code>SYSTEM.md</code>, <code>MISSION.md</code>, and <code>RULES.md</code> to the system prompt under explicit headings.</p>
188<p>Missing core files do not receive invented defaults.</p>
189<p>Existing core files are read-only to agent <code>write</code>, <code>edit</code>, and recognizable shell-write paths.</p>
190<p>Missing core files may be created once by the initialization workflow after the user approves their drafts.</p>
191<p>New specs and new spec-owned mockup assets may be created after conversational approval without a redundant UI gate.</p>
192<p>Edits to existing specs or existing spec-owned mockup assets require interactive UI approval.</p>
193<p>The gate is a safety net, not a security boundary.</p>
194</section>
196<section>
197<h2>Initialization</h2>
198<p><code>/system-init [PROJECT-PREFIX]</code> is a thin prompt that requires the <code>the-system-init</code> skill.</p>
199<p>The skill:</p>
200<ol>
201<li>Resolves and reports the project root.</li>
202<li>Inspects existing README, agent instructions, build files, tests, and project structure.</li>
203<li>Reads existing <code>.system</code> files without overwriting human-owned content.</li>
204<li>Asks one focused question at a time about purpose, audience, non-goals, engineering constraints, security, data, tests, and release expectations.</li>
205<li>Proposes the project prefix when absent.</li>
206<li>Drafts minimal <code>MISSION.md</code>, <code>RULES.md</code>, and canonical <code>SYSTEM.md</code>.</li>
207<li>Gets explicit human approval before writing each missing core file.</li>
208<li>Creates missing directories and <code>config.json</code>.</li>
209<li>Copies the current bundled <code>system.css</code>.</li>
210<li>Validates the completed system.</li>
211</ol>
212<p>Rerunning initialization is idempotent.</p>
213<p>It never overwrites existing core files.</p>
214<p>It upgrades machine-owned config and CSS only after reporting the changes.</p>
215<p>Startup compares installed schema/style versions with project config.</p>
216<p>Outdated or incomplete projects receive one concise notification directing the user to <code>/system-init</code>.</p>
217</section>
219<section>
220<h2>Document graph</h2>
221<table>
222<tr><th>Artifact</th><th>Role</th><th>Relationship</th></tr>
223<tr><td><strong>MISSION</strong></td><td>Why the project exists.</td><td>Independent core law.</td></tr>
224<tr><td><strong>RULES</strong></td><td>How work must be done.</td><td>Independent core law.</td></tr>
225<tr><td><strong>SPEC</strong></td><td>What behavior is approved.</td><td>Leaf truth; references no other system document.</td></tr>
226<tr><td><strong>ROADMAP</strong></td><td>Sequences delivery of one oversized spec.</td><td>Names its single parent spec.</td></tr>
227<tr><td><strong>PLAN</strong></td><td>Defines executable implementation steps.</td><td>Names one spec and, when applicable, one phase in that spec’s roadmap.</td></tr>
228<tr><td><strong>ISSUE</strong></td><td>Records a defect.</td><td>Names the specs whose contracts are violated.</td></tr>
229<tr><td><strong>TEST</strong></td><td>Proves behavior.</td><td>Names the specs whose contracts it verifies.</td></tr>
230</table>
231<p>Specs do not reference roadmaps, plans, issues, research, or tests.</p>
232<p>A spec may link adjacent mockup files that are owned as part of that spec.</p>
233<p>Deleting, renaming, or editing a spec therefore exposes every dependent reference without creating cycles.</p>
234</section>
236<section>
237<h2>HTML source contract</h2>
238<ul>
239<li>Documents are complete HTML files with doctype, language, UTF-8 charset, viewport metadata, title, and <code>../system.css</code>.</li>
240<li>Source uses semantic elements: <code>header</code>, <code>main</code>, <code>section</code>, headings, paragraphs, lists, tables, <code>aside</code>, <code>figure</code>, and <code>details</code>.</li>
241<li>Generic wrappers exist only when a layout cannot be expressed semantically.</li>
242<li>Source is formatted, unminified, and directly editable.</li>
243<li>One sentence per line remains preferred for prose.</li>
244<li>Inline CSS may implement document-specific layouts or visual explanations.</li>
245<li>Inline CSS cannot redefine Nugu colors, shared typography, shared breakpoints, or core components.</li>
246<li>Compact hand-authored inline SVG is allowed when relationships cannot be explained clearly with HTML boxes, lists, tables, or text.</li>
247<li>Generated SVG sludge and diagram libraries are forbidden.</li>
248<li>Inline JavaScript is optional, dependency-free, and limited to progressive disclosure, filtering, or tiny interactive explanations.</li>
249<li>Documents remain complete and readable with JavaScript disabled.</li>
250<li>JavaScript cannot use network requests, external dependencies, browser storage, or remote executable resources.</li>
251<li>External script sources, iframes, objects, embeds, meta refresh, remote CSS imports, event-handler attributes, and executable URL schemes are rejected.</li>
252<li>Remote HTTPS anchors are navigation, not runtime resources, and remain allowed.</li>
253<li>The validator accepts the deliberately narrow authored subset described here and rejects ambiguous active markup.</li>
254</ul>
255</section>
257<section>
258<h2>Shared CSS</h2>
259<p>The bundled stylesheet owns the visual language and is copied to <code>.system/system.css</code>.</p>
260<p>It uses the Nugu semantic palette.</p>
261<p><code>prefers-color-scheme</code> selects coherent light or dark surfaces; one mode never mixes inverted surfaces from the other.</p>
262<p>It provides brutal borders, shadows, semantic dossier hierarchy, tables, contracts, callouts, flows, metadata, code, status, and document navigation.</p>
263<p>It is mobile-first, avoids page-level horizontal scrolling, stacks sections at narrow widths, wraps diagrams, and preserves readable touch targets.</p>
264<p>The accepted visual direction is a spec-owned asset:</p>
265<p><a href="./2026-07-11-the-system-design-mockup-nugu-unified-dossier.html">Nugu semantic dossier mockup</a></p>
266</section>
268<section>
269<h2>Document metadata</h2>
270<p>Every authored document contains exactly one readable JSON block:</p>
271<pre><code>&lt;script type="application/json" id="system-meta"&gt;
272{
273 "id": "PX-ISSUE-001",
274 "type": "issue",
275 "status": "open",
276 "specs": ["PX-SPEC-003"]
277}
278&lt;/script&gt;</code></pre>
279<p>Metadata keys are exact; unknown keys fail validation.</p>
280<table>
281<tr><th>Type</th><th>Required metadata</th></tr>
282<tr><td>Spec</td><td><code>id</code>, <code>type: "spec"</code></td></tr>
283<tr><td>Roadmap</td><td><code>id</code>, <code>type: "roadmap"</code>, one <code>spec</code> ID</td></tr>
284<tr><td>Plan</td><td><code>id</code>, <code>type: "plan"</code>, one <code>spec</code> ID, optional <code>roadmap</code> ID and positive integer <code>phase</code></td></tr>
285<tr><td>Issue</td><td><code>id</code>, <code>type: "issue"</code>, <code>open|fixed</code> status, unique <code>specs</code> array; the array may be empty while the violated contract is unknown</td></tr>
286<tr><td>Research</td><td><code>id</code>, <code>type: "research"</code>, ISO capture date, optional unique HTTPS source URLs</td></tr>
287</table>
288<p>Specs contain no status and no outgoing system-document metadata.</p>
289<p>Metadata is the reference authority; validators never infer references from prose.</p>
290<p>Normal HTTPS anchor links are allowed for human navigation and research citations.</p>
291<p>Validators reject malformed or duplicate metadata blocks, duplicate JSON keys, duplicate IDs, filename/ID mismatch, invalid statuses, and unsupported types.</p>
292<p>Dangling metadata references are reported by system diagnostics.</p>
293<p>Tests reference specs with a language-appropriate comment containing <code>SYSTEM-SPEC: PX-SPEC-001</code>.</p>
294<p>Doctor reports discovered test references when test roots are conventional, but missing test references remain a review contract rather than a universal filesystem rule.</p>
295</section>
297<section>
298<h2>Lifecycle prompts and skills</h2>
299<table>
300<tr><th>Prompt</th><th>Skill</th><th>Contract</th></tr>
301<tr><td><code>/system-init [PREFIX]</code></td><td><code>the-system-init</code></td><td>Guided project-system creation or machine-asset upgrade.</td></tr>
302<tr><td><code>/system-doctor</code></td><td><code>system-doctor</code></td><td>Run deterministic validation and explain findings.</td></tr>
303<tr><td><code>/system-spec &lt;idea&gt;</code></td><td><code>brainstorming</code></td><td>Design, review, approve, and write one HTML spec.</td></tr>
304<tr><td><code>/system-roadmap &lt;SPEC-ID&gt;</code></td><td><code>writing-roadmaps</code></td><td>Split an oversized approved spec into ordered phases.</td></tr>
305<tr><td><code>/system-plan &lt;SPEC-ID|ROADMAP-PHASE&gt;</code></td><td><code>writing-plans</code></td><td>Write one executable HTML implementation plan.</td></tr>
306<tr><td><code>/system-impl &lt;PLAN-ID&gt;</code></td><td><code>executing-plans</code></td><td>Execute an approved plan with tests and review checkpoints.</td></tr>
307<tr><td><code>/system-issue &lt;report&gt;</code></td><td><code>system-issues</code></td><td>Triage, deduplicate, and record a defect without fixing unless asked.</td></tr>
308</table>
309<p>Prompt templates remain thin.</p>
310<p>Workflow logic lives in skills.</p>
311<p>A shared <code>system-documents</code> skill owns HTML, metadata, ID, reference, mockup, and browser-review rules.</p>
312<p>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.</p>
313<p>No provider-specific research or Git sync prompt is included.</p>
314</section>
316<section>
317<h2>Browser review</h2>
318<p>After writing or materially editing an authored HTML document, the agent prints its exact path and asks whether to open it in the browser.</p>
319<p>It does not open the browser or editor automatically.</p>
320<p>If approved, a bundled cross-platform Node helper converts the local path to a file URL and tries the platform opener without a shell.</p>
321<p>The helper is a skill script, not an always-visible tool.</p>
322<p>The source path remains the editing interface.</p>
323</section>
325<section>
326<h2>System doctor</h2>
327<p><code>/system-doctor</code> invokes a focused skill and deterministic validator script.</p>
328<p>It reports:</p>
329<ul>
330<li>missing core files or directories;</li>
331<li>invalid or outdated config and CSS versions;</li>
332<li>invalid HTML document shells;</li>
333<li>metadata and filename mismatches;</li>
334<li>duplicate IDs;</li>
335<li>dangling references;</li>
336<li>specs with forbidden outgoing system-document references;</li>
337<li>orphaned spec-owned mockups;</li>
338<li>forbidden external executable resources;</li>
339<li>wrong stylesheet paths.</li>
340</ul>
341<p>Doctor never mutates files.</p>
342<p>Blocking write validation and doctor use the same validation module.</p>
343</section>
345<section>
346<h2>Extension structure</h2>
347<pre><code>extensions/the-system/
348├── index.ts
349├── mockup.ts
350├── system.ts
351├── documents.ts
352├── assets/system.css
353├── prompts/
354│ ├── system-init.md
355│ ├── system-doctor.md
356│ ├── system-spec.md
357│ ├── system-roadmap.md
358│ ├── system-plan.md
359│ ├── system-impl.md
360│ └── system-issue.md
361├── scripts/open-document.mjs
362├── scripts/doctor.mjs
363├── skills/
364│ ├── the-system-init/
365│ ├── system-documents/
366│ ├── system-doctor/
367│ ├── system-issues/
368│ └── existing workflow skills...
369└── __tests__/</code></pre>
370<p><code>index.ts</code> registers existing tasks/mockups and delegates governance registration to <code>system.ts</code>.</p>
371<p><code>documents.ts</code> contains pure root, metadata, ID, reference, and narrow authored-HTML validation logic shared by extension hooks and scripts.</p>
372<p>Validation is structural lint for trusted project documents, not a browser sandbox or proof about arbitrary JavaScript.</p>
373<p>Node standard library remains sufficient.</p>
374</section>
376<section>
377<h2>Behavioral contracts</h2>
378<table>
379<tr><th>Contract</th><th>Proof</th></tr>
380<tr><td>Simple Git, Git worktree, JJ, colocated, conflict, and no-VCS roots resolve correctly.</td><td><code>extensions/the-system/__tests__/documents.test.ts</code></td></tr>
381<tr><td>Core Markdown injects in stable SYSTEM/MISSION/RULES order.</td><td><code>extensions/the-system/__tests__/system.test.ts</code></td></tr>
382<tr><td>Existing core edits block; missing-core creation passes.</td><td><code>extensions/the-system/__tests__/system.test.ts</code></td></tr>
383<tr><td>New specs/assets pass; edits to existing specs/assets require UI approval.</td><td><code>extensions/the-system/__tests__/system.test.ts</code></td></tr>
384<tr><td>Metadata, IDs, filenames, references, HTML shell, CSS link, and forbidden resources validate.</td><td><code>extensions/the-system/__tests__/documents.test.ts</code></td></tr>
385<tr><td>Doctor reports without mutation.</td><td><code>extensions/the-system/__tests__/doctor.test.ts</code></td></tr>
386<tr><td>Initialization is guided, approval-bound, root-aware, idempotent, and core-preserving.</td><td><code>extensions/the-system/__tests__/workflow-skills.test.ts</code></td></tr>
387<tr><td>Lifecycle prompts are exported and delegate to the named skills.</td><td><code>extensions/the-system/__tests__/workflow-skills.test.ts</code></td></tr>
388<tr><td>Shared CSS contains exact Nugu light/dark tokens and responsive contracts.</td><td><code>extensions/the-system/__tests__/documents.test.ts</code></td></tr>
389<tr><td>Existing task branch and mockup behavior survives the hard rename.</td><td><code>extensions/the-system/__tests__/super.test.ts</code> and <code>mockup.test.ts</code></td></tr>
390<tr><td>Package manifests and static tooling contain no live <code>extensions/super</code> references.</td><td><code>scripts/test_extensions_static_check.mjs</code></td></tr>
391</table>
392</section>
394<section>
395<h2>Migration</h2>
396<ol>
397<li>Rename the extension directory and package.</li>
398<li>Keep task/mockup implementation behavior stable.</li>
399<li>Add governance, document validation, Nugu CSS, scripts, skills, and prompts.</li>
400<li>Convert workflow outputs from Markdown paths to project-local HTML paths.</li>
401<li>Update accepted mockup persistence to produce spec-owned adjacent HTML assets and HTML links.</li>
402<li>Export prompts and renamed skills from root package resources.</li>
403<li>Update live references and regenerate the lockfile through the existing mise/npm workflow.</li>
404<li>Run focused tests, real extension loading, static checks, and <code>mise run ci</code>.</li>
405</ol>
406<p>Existing user filters or paths naming <code>extensions/super</code> break intentionally.</p>
407<p>No migration shim, alias, duplicate package, or deprecated path remains.</p>
408</section>
410<section>
411<h2>Security and failure policy</h2>
412<ul>
413<li>Resolve and normalize every governed path before ownership checks.</li>
414<li>Reject traversal outside the resolved project root.</li>
415<li>Treat approval hooks and active-markup lint as advisory safeguards, not sandboxing.</li>
416<li>Project core files are privileged instructions; initialization must explain this trust boundary before writing them.</li>
417<li>Never execute authored document JavaScript during validation.</li>
418<li>Never fetch document resources during validation or doctor runs.</li>
419<li>Never place secrets, raw private data, or binary asset bytes in system documents.</li>
420<li>Fail on ambiguous roots, malformed machine state, duplicate IDs, and invalid required metadata.</li>
421<li>Report dangling references and upgrade availability without silent repair.</li>
422<li>Preserve unrelated dirty work.</li>
423</ul>
424</section>
425</main>
426</article>
427</body>
428</html>