Repository navigation
feat(design): DESIGN.md read, lint and draft behind the live flag (design mode v2 Phase DM) - #915
sambitcreate wants to merge 31 commits into
Conversation
…N.md draft once per app
…out, keep big exports as a size
…nd guard the list
There was a problem hiding this comment.
Important
Three contract gaps need fixes before merge: duplicate concurrent lints/events, an answer-size overflow, and guidance for an excluded tool.
Reviewed changes across the complete Phase DM stack through d5083ab60, including the feature gate, canvas configuration and app discovery, DESIGN.md safety/lint/cache/draft/tool paths, turn and prompt integration, IPC/analytics, packaging, release verification, documentation, and tests.
- DESIGN.md runtime: Adds safe lookup/read behavior, bounded worker-thread lint/export, caching, retries, and supplemental findings.
- Agent surface: Adds fenced read/lint/export/draft responses, per-turn status and draft offers, analytics, and design-canvas prompt/tool wiring.
- Distribution contracts: Pins and trims
@google/design.md, verifies packaged contents and runtime behavior, and documents the gated feature.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
There was a problem hiding this comment.
Important
A previously journaled DESIGN.md prompt can survive a later excluded-tool turn, so one prior contract gap remains.
Reviewed changes since the prior Pullfrog review at d5083ab60, covering the three review fixes and their as-built documentation.
- Coalesced shared worker runs: Made overlapping reads and exports share one worker result while preserving per-caller cancellation and once-per-content analytics.
- Bounded complete read payloads: Trimmed sections, omissions, and tokens together so JSON escaping cannot push the fenced data past 64 KiB.
- Gated current-turn DESIGN.md wiring: Suppressed the newly built tool, static bullet, status sentence, and draft offer when
design_systemis excluded. - Recorded the review fixes: Updated the Phase DM as-built notes with the revised runtime contracts.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at 6c4955ab5, covering the retained transcript-guidance fix.
- Replaced stale DESIGN.md guidance: Updated
withDesignModeSectionto replace a journaled section containing the exact static DESIGN.md bullet when the current turn lacksdesign_system, while preserving unrelated flag-off sections. - Covered the retained-section lifecycle: Added a behavioral test that journals the live section, transitions to a turn without DESIGN.md support, verifies the tool guidance is gone, and confirms the following turn adds nothing.
- Recorded the final review fix: Updated the Phase DM as-built notes to match the corrected prompt-section behavior.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

This is stacked on #911 (Phase 2a), which sits on #908 (1b) and #894 (1a). Merge them in that order; GitHub retargets each PR when its base merges.
This is Phase DM of design mode v2:
docs/superpowers/specs/2026-11-23-design-mode-live-app-design.md§6.9 and §8;docs/superpowers/plans/2026-11-24-design-mode-v2-dm-design-md.md, including its "As built" section;Aiden now reads, lints and drafts an app's
DESIGN.md(Google's open format,@google/design.mdpinned at exactly0.4.0). All of it sits behindAIDEN_EXPERIMENTAL_DESIGN_LIVE. With the flag off, prompts, tools and behaviour are byte-for-byte unchanged, and no lint worker starts.What changes
Feature flag
designLiveEnabled()inmain/services/studio/feature-flags.tsis true only when design mode is on andAIDEN_EXPERIMENTAL_DESIGN_LIVEis1,true,yesoron, trimmed and case-insensitive.studioCapabilities()reportsdesignLive. Phases 2b–5 reuse this helper..aiden/canvas.jsonreader (canvas-config.ts).is allowed, and.., absolute paths, backslashes, NUL and anything over 200 characters are refused. The file is understood whenversionis missing or1; any other value reads asunsupported-version.configuredRoots: the scripted entries that detection also sees as web apps. 2b uses this to decide what may start.describedRoots: those entries, or detection when there are none. DESIGN.md lookup uses this.readCanvasConfigTextgives the reason a read failed (missing, link, too large or unreadable), and a raw-object read keeps fields a phase doesn't know about.Finding and reading DESIGN.md (
design-md/)build/main/design-md-lint-worker.js.readyonce it has imported the linter. Loading has a 10 s limit, then the lint has a 2 s deadline before the worker is terminated.timed-outresult is cached for each content hash and retried after 5 minutes.timed-outat about 2.2 s, and the main thread lags by at most 16 ms.busy. After a load timeout, the linter is marked unavailable for the rest of the run.DESIGN.mdthat resolves to a credential or env-secret file (.env,.npmrc, key files) is refused, the same wayread_filerefuses them.aiden/duplicate-section, using its own alias table checked against the package'sspec-config.yaml, andaiden/unresolved-ref.JSON.stringify-ed. Everything that comes from the file is fenced as data and length-bounded.The
design_systemtoolread,lint(optionally with draftcontent),exportanddraft, where export targets are Tailwind v4, CSS variables and DTCG.draftbuilds text from the app's own style files with v1's scanner, which moves todesign-md/style-scan.ts. It never writes a file: Aiden writes it withwrite_fileunder the ordinary approvals.Turn integration
design-canvas-statusnote gets one sentence with each app's DESIGN.md state. App roots are read in parallel, and the sentence has a 3 s budget.ask_user_questionis offered and not excluded.offer-log.ts, keeping the same HMAC.IPC and packaging
designCanvas:designSystemvalidates its request and checks the app root.node_modules, spec files, and 18 hoisted packages that only the CLI and MDX parsers reach are left out of the asar. Of these,verifyPackagedDesignMdLinterchecks that the 18 packages are absent and that the trimmed linter still lints. A guard test fails if another production dependency starts needing one of them.scripts/design-md-packaged-acceptance.mjs(npm run test:design-md:packaged) runs the IPC inside the packaged macOS app inrelease.yml, withAIDEN_ANALYTICS=0.Analytics
Two new events, each with a registry entry, a docs row and a test:
design_md_linted, sent once for each new content of a file per run, and never for acontentlint or an IPC read;design_md_drafted {source: "app"}.Their properties are only buckets or enums.
Review
versionrules and the worker deadline..envlink. The other covered correctness, contracts and test quality.Tests
npm run test:design-mode: 1043/1043 (base 922), after the Pullfrog fixes.test:analytics175; feature-flags, prompt-prefix and harness 200;test:ci-policy123;main-runtime-dependencies2/2; verify-macos/linux package tests 47/47.npx tsc --noEmit -p .,npm run lint,npm run buildandnpm run cli:buildpass.--dirbuild's asar passesverifyPackagedDesignMdLinter.Notes
test:design-md:packaged). It opens a macOS window, and no PR workflow packages macOS, so it runs inrelease.yml.npm run testunder load had three failures that pass when run alone. One isguest-driver-install"suspending…", which is timing-sensitive and failed the same way on base. The other two areuse-assistant-livemicrophone tests.npx tsc -p main/tsconfig.jsonreports the same errors on the base commit.History isn't rewritten on a PR branch.
main/index.tsis hard-coded, so a futurestudioCapabilitieskey would need adding there by hand.design_systemgets no DESIGN.md prompt, note or offer).🤖 Generated with Claude Code