Skip to content

feat(onboarding): add natural-language initialization#243

Merged
qwerfunch merged 28 commits into
developfrom
feature/natural-language-init
Jul 20, 2026
Merged

feat(onboarding): add natural-language initialization#243
qwerfunch merged 28 commits into
developfrom
feature/natural-language-init

Conversation

@qwerfunch

@qwerfunch qwerfunch commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • make clad setup an explicit project-scoped activation instead of machine-global host injection
  • wire Claude Code, Codex, Antigravity, and Cursor through project discovery files and a portable local MCP launcher
  • keep setup-only projects inert: ordinary work cannot initialize Cladding, and mutating tools fail closed before a valid spec exists
  • require explicit Cladding naming, a read-only preview, an exact staged draft, and a separate one-time approval before authored files are written
  • persist only the approved draft in ignored project runtime so process-per-turn hosts cannot lose or reinterpret it
  • migrate provably Cladding-owned 0.8.3 global wiring while preserving ambiguous or hand-edited host configuration
  • use AGENTS.md as the shared managed instruction surface; preserve existing CLAUDE.md and never create one
  • update install/update guidance, diagnostics, generated host integrations, onboarding spec, and empirical dogfood records

Why this is safer than 0.8.3

0.8.3 This PR
global wiring could enter unrelated host sessions projects without clad setup receive no Cladding project wiring
host availability could be confused with activation CLI installation and per-project activation are separate
natural language could route too eagerly initialization requires the user to name Cladding explicitly
initialization could write immediately prepare and stage do not author project files; apply requires a separate exact approval
a restarted host could lose its generated draft the exact staged draft survives process-per-turn hosts in ignored project runtime
approval text could be reinterpreted as a new intent approval is pattern-validated and can apply only the previously staged draft
cleanup risked user configuration only provably owned legacy entries are removed; ambiguous entries are reported and preserved

Install and update UX

npm install -g cladding
cd <project>
clad setup
# Start a new supported AI-host session from this project.

npm install -g can run anywhere and installs only the CLI. clad setup runs once in each project that should expose Cladding. clad update refreshes both project wiring and derived state.

Packed-tarball host campaign (2026-07-16)

The definitive campaign installed the packed 0.9.0 tarball in isolation and drove real init scenarios through all five host CLIs across plain control, setup-only control, idea initialization, complete-document initialization, existing-code adoption, and legacy migration. Full report: docs/dogfood/e2e-0.9.0-packed-2026-07-16.md.

Host Result
Claude Code verified — full gate, live consent boundary held (weekly quota released early, so it ran)
Codex CLI verified — full gate; drove the process-per-turn draft-staging fix in this PR
Antigravity CLI verified — full gate; user config restored byte-for-byte
Gemini CLI honest fail — personal tier ended (IneligibleTierError), recorded not-run
Cursor Agent honest fail — usage limit, recorded not-run

The consent boundary held on every host that ran: even with permissions bypassed, each host stopped and refused paraphrased approval. clad doctor --hosts was modernized to probe this project-local model, so the shipped diagnostics match the campaign.

Defects found and fixed by the campaign

  • Setup wires only detected hosts by default — previously every project received all five hosts' config regardless of what was installed; clad setup --host all remains the explicit override. (The old setup shard's twelve dangling test refs were rewritten.)
  • Antigravity actually connects now — agy reads MCP config machine-wide only (a negative control proved the project file is never loaded), so setup also writes an ownership-guarded ~/.gemini/config/plugins/cladding/ wire — the one stated exception to project-local activation.
  • clad update outside a cladding project writes nothing — it used to scaffold host wiring into any directory and could reach an account-wide legacy plugin uninstall.
  • Abandoned onboarding preparations no longer accumulate — expired consent-cache envelopes are swept on staging (hundreds had piled up), and a tampered staged draft is re-validated and rejected cleanly instead of crashing.
  • Legacy cleanup preserves your global config formatting — the codex config.toml entry is spliced out textually (comments/ordering survive, parse-verified), and cursor cleanup no longer leaves an orphan empty mcpServers.
  • clad doctor --hosts probes match the project-local model — project-MCP approval for the consented Claude probe, project-directory Antigravity probe, Codex approvals bypass, and a realistic gate timeout.

Legacy 0.8.3 migration was tested separately: owned entries were removed, unrelated entries retained, ambiguous wrappers preserved and reported, and a second run stayed safe.

Also changed

  • The deterministic collector found nine onboarding commit subjects that do not name a spec feature. Their user-visible behavior is covered by the spec-backed changes above, but their commit-to-spec linkage remains absent — recorded honestly rather than back-filled.

Verification

  • npm run typecheck: passed
  • npm run lint: passed
  • npm test: 237 files, 2,561 tests passed
  • node bin/clad sync: 255 feature shards valid
  • node bin/clad check: all functional stages green
  • git diff --check: passed
  • working tree clean; branch is a clean superset of develop (28 commits ahead, 0 behind)

qwerfunch and others added 28 commits July 14, 2026 15:33
- host-instructions.ts: drop the pre-0.9.0 'global home + npm postinstall'
  header claim; .mcp.json/.codex/config.toml are project-local via clad setup
- update.ts: comments no longer call the host re-wire 'global'; note that
  wiring runs before the spec.yaml guard
- orchestrator.md: insert the mandatory clad_stage_init step between prepare
  and the planned-changes display, matching skills/init/SKILL.md and the
  server's own prepare instruction (process-per-turn hosts dead-ended without it)
- server.ts: clad_prepare_init is 'non-destructive', not 'read-only' — it
  persists a TTL'd consent-cache envelope (tmpdir tier before staging)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Live campaign against the packed 0.9.0 tarball across all five hosts
surfaced these; each fix carries a regression test.

- setup default now wires only detected hosts (spec AC-001 restored);
  --host all stays the explicit override, zero-detection warns and
  writes just the shared runtime
- Antigravity: agy 1.1.2 never reads project MCP config (proved by
  negative control), so setup also writes the machine-wide
  ~/.gemini/config/plugins/cladding wire (engine-absolute launch,
  project resolved from session cwd); foreign dirs/symlinks preserved
  without --force; reported as the one project-local exception
- clad update outside a project no longer wires hosts (13-file cwd
  pollution + reachable account-wide claude plugin uninstall)
- staged onboarding drafts are schema-revalidated on apply; a tampered
  durable cache now returns draft_required instead of a raw TypeError
- consent-cache staging sweeps expired envelopes (644 stale files had
  accumulated in the shared temp dir on the reference machine)
- codex legacy cleanup splices the TOML section textually (user
  comments/formatting preserved, parse-verified with lossy fallback);
  cursor cleanup no longer leaves an orphan empty mcpServers
- setup-command-80d19d shard rewritten to the project-scoped contract
  (all 12 test_refs were dangling since the 0.9.0 rewrite); docs/setup.md
  documents detection, the agy exception, codex headless approvals, and
  the refreshed per-host verification levels

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e-wire

- doctor probes match the project-local model: the consented Claude probe
  auto-approves the project .mcp.json server, the Antigravity probe runs in
  the project directory with agy's permissions bypass (it used to leave the
  project via --new-project), the Codex probe bypasses approvals (annotated
  non-read-only tools were auto-denied headlessly), and run-check gets a
  gate-sized timeout instead of grading slowness as failure
- eslint ignores .cladding/ (machine-local runtime state; the regenerated
  host launcher tripped no-require-imports)
- re-wire the repo itself post-migration: project-local wiring for all five
  hosts (this repo dogfoods the 0.9.0 model it ships)
- docs/dogfood/matrix.md regenerated at 0.9.0 by the packed tarball:
  claude/codex/antigravity verified live (all three sentinel surfaces incl.
  the full gate), gemini fail (IneligibleTierError — account tier), cursor
  wiring pass + model surfaces fail (account usage limit); README host-claims
  fence synced to claim no more than the evidence
- campaign report docs/dogfood/e2e-0.9.0-packed-2026-07-16.md + CHANGELOG
  section for the campaign-hardening fixes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Four-way read-only audit (README 6 variants / docs tree / code residue /
internal skills+personas+mirrors) before release. Core verdict was coherent;
these are the residuals it surfaced.

Docs:
- README.html + README.ko.html were half-migrated and still taught the
  retired machine-wide wiring model ("does not create or modify project
  files", separate machine-level clad setup in Update) and re-introduced
  the removed background-verification-loop overclaim — ported the 0.9.0
  Install/Update sections from the markdown, incl. the consent-phrase
  paragraph and the 5-host list
- ja/zh READMEs: intro/table/wrapping still said 4 hosts (Gemini missing,
  contradicting their own setup blocks); zh test-file count 234→236
- all six variants: feature counts synced to the measured 255 total /
  252 done (intro said 251-of-254, status said 251 done)
- four md variants: clad setup sentence now says detected hosts and names
  Antigravity as the one machine-wide exception with a setup.md pointer
- CLAUDE.md: version-bump covers eleven sites, not nine (two spots)
- glossary: setup verb host list gains Antigravity; ssot-model: two
  leftover 'refine' verbs → clarify

Internal instruction md:
- serve skill advertised only 4 tools — now describes the full surface
  incl. the 0.9.0 onboarding trio and pre-init gating
- src/agents/README: 6 personas (blind-author row added), real mirror
  targets (claude-code/codex/antigravity), dropped the nonexistent
  commands/clad.md and gemini per-verb claims
- check skill: frozen '37/37 as of v0.6.1' and stale plugin.json path
  replaced with the recount mechanism; oracle skill description trimmed
  to the picker-budget; planner scenario-policy names the host MCP flow
  (and stays within its pinned persona budget)

Code residue:
- deleted resolveServeLaunch (orphaned by this branch) and the superseded
  writeAgentsMd + AGENTS_MD_TEMPLATE; the three tests pinning the dead
  template now pin the live spec-driven managed block, which carries the
  same interpreter-rule/anti-self-cert/feature-cycle literals
- renamed 'skipped-not-installed' → 'skipped-not-selected' (the render
  label already said 'not selected')
- setup-command AC-013 narrowed to the CLAUDE.md-only refresh reality;
  agent-interpreter-rule AC text names the managed block
- knownRoots comment: home status file is a frozen pre-0.9.0 artifact
- test-count badges resynced (2561 after removing 5 dead-template tests)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@qwerfunch
qwerfunch merged commit ab95189 into develop Jul 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant