{
  "schema": "kiwe.command-manifest.v1",
  "productName": "SeamFlow",
  "flowName": "seamflow",
  "purpose": "Fast machine-readable SeamFlow slash-command router for browser AIs, IDE AIs, MCP clients, skill-capable agents, and Companion-assisted Kiwe workflows.",
  "entry": {
    "humanPattern": "read https://raw.githubusercontent.com/Museintel/kiwe/main/KIWE-START.md",
    "rawEntrypoint": "https://raw.githubusercontent.com/Museintel/kiwe/main/KIWE-START.md",
    "machineEntrypoint": "https://raw.githubusercontent.com/Museintel/kiwe/main/kiwe-ai-toolkit/entry.json",
    "contractVersion": "7.22",
    "rule": "Read SeamFlow Start first, report the SeamFlow contract version, then route the next slash command through this manifest. Treat explore as a location pointer, not permission to crawl the repository."
  },
  "architecture": {
    "seamflow": "External AI command-central flow for Seam Framework + Bricks-powered webpages, headers, footers, reusable templates, Framework profiles, dynamic intent, and accessibility.",
    "compilerAuthority": "SEAM Compiler 0.13.0 is the deterministic authority for raw Bricks conversion, optional one-pass Framework optimization, and executable conversion proof. Browser AI must not manually recreate production Bricks JSON or Framework Profile data.",
    "stageBoundary": "Raw /convert /bricks is Framework-neutral. Optional /convert /bricks /seamframework is the preferred one-pass Framework mode; /seamframework remains valid while raw evidence is retained. Both emit one project-wide Framework Profile, stable profile-installed class IDs, dependent templates, and executable package audit proof. Accessibility is a separate explicit stage after Framework and has its own executable audit gate.",
    "kiweInternalAi": "Bounded Kiwe Companion/Internal AI. It can assist when /usecompanion or API/MCP access exists, but browser-only SeamFlow must still work without it.",
    "currentLaunchScope": "Close page-builder flow through Seam Framework first: Framework profile, Bricks pages/header/footer/templates, stable class and variable ownership, and executable /audit /seamframework proof. Accessibility follows as a separate active phase with measured evidence and executable audit proof.",
    "nextPhase": "DSA/AppShell theme remains mapped, but full DSA theme production hardening comes after page-builder flow testing passes."
  },
  "pluginApi": {
    "rule": "When KIWE_REST_BASE and KIWE_AI_KEY are supplied, call the plugin SeamFlow REST routes instead of reconstructing validators or manually claiming closure.",
    "scope": "seamflow, studio_ai, bricks_ai, or all",
    "askWhenMissing": "If Route C/D, /usecompanion, plugin validation, or live Site Graph/API proof is selected and credentials are absent, ask for KIWE_REST_BASE and KIWE_AI_KEY. Tell the human to create the key in WordPress Admin → Kiwe → AI → API access keys with seamflow, studio_ai, bricks_ai, or all.",
    "routes": {
      "status": "{KIWE_REST_BASE}/ai/seamflow/status",
      "classify": "{KIWE_REST_BASE}/ai/seamflow/classify",
      "rebuild": "{KIWE_REST_BASE}/ai/seamflow/rebuild",
      "audit": "{KIWE_REST_BASE}/ai/seamflow/audit",
      "frameworkProfile": "{KIWE_REST_BASE}/ai/seamflow/framework-profile",
      "convertBricks": "{KIWE_REST_BASE}/ai/seamflow/convert-bricks",
      "accessibility": "{KIWE_REST_BASE}/ai/seamflow/accessibility",
      "execute": "{KIWE_REST_BASE}/ai/seamflow/execute"
    }
  },
  "globalRules": {
    "readPolicy": [
      "Read KIWE-START.md or entry.json first when the human gives only the Kiwe repo/link.",
      "Do not read the whole repository.",
      "Do not clone the repository for a slash-command lane unless the human explicitly asks you to inspect implementation source.",
      "Do not search GitHub docs for hidden contracts. This manifest plus the listed context files are the contract for the matched command.",
      "Do not use general web search, arXiv, unrelated GitHub search, commit browsing, stale local examples, prior-output research, or prior accepted notes to complete SeamFlow.",
      "Do not use search results when an exact raw URL/context route is required. If your environment starts a search instead of direct raw fetch/open, stop with ERROR: KIWE_SEARCH_DRIFT.",
      "After the first Start classification response, treat the loaded Start file as the active contract for the immediate next /command in the same conversation. Do not reload the repository, README, GitHub pages, commits, arXiv, search results, old examples, or Start again for that next command.",
      "Do not mark artifact lanes PASS from manual confidence, copied/reconstructed validator logic, simulated validator logic, or equivalent checks. PASS requires executable validator proof.",
      "Do not use prior Kiwe validation material, old National Chikki/BioVantage attempts, previous browser-AI outputs, local downloads, search results, or accepted notes unless the human supplied those exact files in the current turn or explicitly asked for comparison.",
      "Read only the context files listed for the matched command.",
      "Prefer this JSON manifest first when available because it is smaller and less ambiguous than prose.",
      "When files are supplied without a slash command, run kiwe_seamflow_plan, compatibility alias kiwe_plan_flow, or use entry.json flowPlanner rules before generation.",
      "If a required artifact is missing, stop with a compact diagnostic instead of guessing."
    ],
    "documentation": "Documentation is opt-in. Do not create README, NOTES, reports, duplicate previews, ZIP files, or explanation documents unless /document is present or the human explicitly asks.",
    "ideation": "For /ideate, auto-detect an attached Kiwe Design Context, preserve owner facts and preferences, ask only missing project-specific creative questions, create only the first Framework-neutral homepage HTML/CSS/JS, and continue small refinements through normal conversation without another command. Bare /accessibility may then improve the current raw page without introducing Seam Framework or Bricks.",
    "finalResponse": "Return a compact result: PASS/FAIL/WARN, files changed, files kept/removed when relevant, validator/audit status, and remaining warnings. Do not write long essays.",
    "companion": "/usecompanion is optional and non-blocking. If MCP/tool access is absent, ask for KIWE_REST_BASE and KIWE_AI_KEY, call one bounded Companion status/context route, report COMPANION: connected with compact route/hash proof on success, or COMPANION: fallback and continue without it on failure.",
    "firstInteractionRoutes": "When files are supplied without a command, always show route choices after the recommended next command: Route A hosted SEAM Compiler, Route B local deterministic compiler, Route C Plugin REST authority bridge, Route D Plugin REST + Companion review. For raw HTML/CSS/JS, choose raw /convert /bricks or one-pass /convert /bricks /seamframework. Accessibility is a separate active stage after conversion or Framework, using /create /accessibility and /audit. Ask for API credentials only for Route C/D or /usecompanion/plugin proof.",
    "structure": "Fix commands preserve the existing artifact lane. They must not restart creative work, silently change lanes, or create unrelated packages.",
    "commandGrammar": "SeamFlow commands are composable shell-like tokens, not fixed magic phrases. Parse the user line into one primary action, optional phase/target, and modifiers. Equivalent valid ordering may be normalized when unambiguous; unknown, contradictory, or lane-invalid combinations stop with KIWE_UNKNOWN_COMMAND or KIWE_WRONG_LANE.",
    "auditClosure": "SeamFlow closes only when the required /audit command for the detected current artifact lane returns PASS after any needed /fix loops. /audit /eachstep audits after each phase; /audit /fix /eachstep explicitly runs phase -> audit -> fix actual artifact if needed -> same audit again until PASS or NEEDS_INPUT. /audit /atend audits before final delivery; /audit /fix /atend explicitly repairs failed final lanes and reruns audits until PASS or NEEDS_INPUT.",
    "validatorAuthority": "Only executed validator proof may close a lane as PASS: SEAM Compiler, official Kiwe validator command, Kiwe MCP validator tool, Kiwe REST/plugin validator, or hosted/local Kiwe validator endpoint. Copied/reconstructed or AI-authored converter/validator logic may guide diagnosis but cannot produce PASS. If unavailable, report WARN or UNVERIFIED. Visual accuracy is INCOMPLETE when viewport provenance differs or foreign overlays contaminate either capture.",
    "browserAiFallback": "When the hosted SEAM Compiler is unavailable, browser AI must use the official local compiler/runtime from the Kiwe source, then the Kiwe REST validation bridge when available. It may invoke tools, prepare source files, interpret executable proof, and fix source defects, but it must never replace the compiler by writing production Bricks JSON, Framework Profiles, measured accessibility ratios, or PASS reports from prose. If no official executable route is available, return WARN/UNVERIFIED with KIWE_VALIDATOR_UNAVAILABLE.",
    "routeFallbackLadder": "Applies to every phase. Prefer Route D when /usecompanion and Plugin REST are reachable. If Companion fails, continue as Route C. If Plugin REST fails or the host cannot resolve, and shell/Node/Git tools are available, immediately fall back to Route B and run the official matching validator/compiler. Only return WARN/UNVERIFIED after Plugin REST failed and no official Git/Node/MCP/hosted validator can execute.",
    "fullFlowDiscipline": "/execute /fullflow means one final delivery, not one giant context load. Execute phase-by-phase, read only the context/validator files for the current phase, close that phase with /audit -> /fix -> /audit, then continue.",
    "reportDiscipline": "/report is an interaction flag. In /execute /stepbystep, stop after the current phase closes, return the phase artifact plus compact generated/audited/fixed/warnings report, and wait for the human to say continue. In /execute /fullflow, /report adds a compact final phase ledger but does not pause between phases.",
    "siteGraphBoundary": "Missing SiteGraph/API/export is not a blocker for static conversion or /usebrickscontext targets. /usesitegraph is an evidence source and requires /for plus explicit targets. Stop for SiteGraph only when a selected target needs real site content/identity/IDs, live binding verification, or staging/apply authority.",
    "errorHandling": "SeamFlow is a command central. If a command, artifact, validator, route, token budget, context window, or requested lane is not valid enough to continue, stop immediately with STATUS plus ERROR: KIWE_* and the next valid command. Do not invent a manual pass or wander into unrelated sources.",
    "compilerContract": "kiwe-ai-toolkit/contracts/seam-compiler-contract.json"
  },
  "errorCatalog": {
    "responseShape": ["STATUS: NEEDS_INPUT | FAIL | WARN", "SeamFlow contract: 7.22", "ERROR: KIWE_...", "Command:", "Current artifact:", "Why stopped:", "Next valid command:"],
    "codes": {
      "KIWE_UNKNOWN_COMMAND": "Unknown or misspelled command token.",
      "KIWE_MISSING_ARTIFACT": "Required current files/attachments are missing.",
      "KIWE_WRONG_LANE": "Supplied artifact does not qualify for the requested command.",
      "KIWE_STALE_SOURCE_BLOCKED": "Only stale/prior outputs are available.",
      "KIWE_VALIDATOR_UNAVAILABLE": "Official validator/tool/API cannot execute.",
      "KIWE_VALIDATOR_PROOF_MISSING": "PASS was claimed without executable validator proof.",
      "KIWE_MANUAL_PASS_BLOCKED": "Only manual confidence is available for an importable lane.",
      "KIWE_PREVIOUS_AUDIT_MISSING": "/fix /previousaudit was requested without immediately previous audit findings.",
      "KIWE_PREVIOUS_OUTPUT_MISSING": "/previousoutput was requested but immediate previous output files are not accessible.",
      "KIWE_CONTEXT_WINDOW_RISK": "Requested flow is too large for the current AI/session.",
      "KIWE_TOKEN_BUDGET_RISK": "Command is likely to waste tokens.",
      "KIWE_TOOL_UNAVAILABLE": "Required MCP/API/browser/validator tool unavailable.",
      "KIWE_SEARCH_DRIFT": "Search engine, arXiv, GitHub search, commit browsing, or prior-example lookup was used or attempted instead of exact raw URL/context routing.",
      "KIWE_SITEGRAPH_REQUIRED": "Live Site Graph/API data was explicitly required but not supplied.",
      "KIWE_COMPANION_FALLBACK": "/usecompanion requested but unavailable.",
      "KIWE_STALE_BRICKS_PAGE_CSS": "Live Bricks preview/builder proof is contaminated by existing page-level Bricks custom CSS or stale selectors from prior imports."
    }
  },
  "flowPlanner": {
    "cli": "kiwe seamflow [--command text] [--artifact-summary text] [--desired-outcome text] [--use-companion]",
    "mcp": "kiwe_seamflow_plan",
    "compatibilityCli": "kiwe plan-flow",
    "compatibilityMcp": "kiwe_plan_flow",
    "purpose": "Classify files and plan the smallest safe path across Seam rebuild, Framework profile, Bricks conversion, DSA theme, combined handoff, and accessibility."
  },
  "contexts": {
    "workflow": "kiwe-ai-toolkit/contexts/workflow-lite.md",
    "ideation": "kiwe-ai-toolkit/contexts/ideate-lite.md",
    "seamAttributes": "kiwe-ai-toolkit/contexts/seam-attributes-lite.md",
    "bricksConversion": "kiwe-ai-toolkit/contexts/bricks-conversion-lite.md",
    "seamCompiler": "kiwe-ai-toolkit/contexts/seam-compiler-lite.md",
    "accessibility": "kiwe-ai-toolkit/contexts/accessibility-lite.md",
    "dynamic": "kiwe-ai-toolkit/contexts/dynamic-lite.md",
    "combined": "kiwe-ai-toolkit/contexts/combined-lite.md",
    "audit": "kiwe-ai-toolkit/contexts/audit-lite.md"
  },
  "commandGrammar": {
    "rule": "Tokens are independent and composable. Do not require a memorized full phrase when a command line is unambiguous.",
    "primaryActions": ["/ideate", "/execute", "/rebuild", "/create", "/convert", "/seamframework", "/audit", "/fix", "/apply", "/list", "/document"],
    "phaseTargets": ["/stepbystep", "/fullflow", "/seamframework", "/frameworkprofile", "/bricks", "/bricksconversion", "/accessibility", "/dsatheme", "/combined", "/allattached", "/allflow", "/previousoutput", "/previousaudit", "/previewdata", "/bricksbindings", "/dynamictags", "/queryloops", "/kiwelaunchers", "/siteidentity", "/designcontext", "/designcontextenhancement"],
    "contextSources": ["/usesitegraph", "/usebrickscontext"],
    "entityScopes": ["/products", "/posts", "/pages", "/media", "/menus"],
    "fieldScopes": ["/titles", "/images", "/prices", "/links", "/excerpts", "/metadata"],
    "modifiers": ["/for", "/audit", "/fix", "/eachstep", "/atend", "/report", "/usecompanion", "/nonai", "/nopreviewdata"],
    "examples": {
      "/execute /fullflow /audit /fix /eachstep": "primary /execute, phase /fullflow, modifiers /audit /fix /eachstep",
      "/execute /stepbystep /audit /fix /eachstep /report": "primary /execute, phase /stepbystep, modifiers /audit /fix /eachstep /report",
      "/audit /allattached /allflow": "primary /audit, targets /allattached and /allflow"
    },
    "invalid": "Unknown tokens, contradictory cadence tokens, or lane-invalid combinations must stop with KIWE_UNKNOWN_COMMAND or KIWE_WRONG_LANE."
  },
  "commands": {
    "/ideate": {
      "phase": "ideate",
      "aliases": ["/ideate /webdraft", "/creative", "/webdraft"],
      "read": ["kiwe-ai-toolkit/contexts/ideate-lite.md"],
      "requires": ["an attached Kiwe Design Context or adaptive answers for facts it does not supply; project relationship; reusable versus inspiration references; any material creative constraints"],
      "output": ["one original homepage as index.html, styles.css, and script.js"],
      "forbidden": ["Bricks JSON", "Site Graph binding", "AppShell or DSA output", "post-conversion Seam migration", "framework-driven visual homogenization", "more than three questions at once", "restarting the interview during normal refinements"],
      "finalResponse": "Auto-detect Design Context, ask only unanswered project-specific creative questions, generate one Framework-neutral homepage, then accept subsequent refinements through normal conversation without another slash command."
    },
    "/list": {
      "phase": "discover",
      "read": ["KIWE-AI.md", "kiwe-ai-toolkit/command-manifest.json"],
      "requires": [],
      "output": ["compact command list"],
      "forbidden": ["generation", "audit", "file creation", "repository crawl"],
      "finalResponse": "List commands only, then stop."
    },
    "/execute /stepbystep": {
      "phase": "execute",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json"],
      "requires": ["classified current artifact or explicit current command path"],
      "output": ["the next safe phase artifact only"],
      "forbidden": ["running the whole flow", "using prior test material", "docs unless /document", "ZIP"],
      "finalResponse": "Run only the next command in the current SeamFlow path. If /audit /fix /eachstep is selected, run audit/fix/audit until PASS or NEEDS_INPUT. If /report is selected, return the artifact plus compact report and wait for human continue."
    },
    "/execute /fullflow": {
      "phase": "execute",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json", "only the contexts required by the current phase, one phase at a time"],
      "requires": ["classified current artifact and human approval for full-flow execution"],
      "output": ["final canonical artifacts for the selected flow"],
      "forbidden": ["using prior test material", "loading all contexts upfront", "general web search", "docs unless /document", "ZIP", "DSA/AppShell output unless target requests DSA or combined", "treating missing Site Graph as a blocker for static Bricks conversion"],
      "finalResponse": "Return only final canonical artifacts after every required closing audit for the detected start point has passed, plus compact pass/fail/warn status."
    },
    "/audit /eachstep": {
      "phase": "flag",
      "read": ["kiwe-ai-toolkit/command-manifest.json"],
      "requires": ["/execute /stepbystep or /execute /fullflow"],
      "output": ["audit/fix gates after each phase before continuing"],
      "forbidden": ["standalone generation"],
      "finalResponse": "Use as an execution flag; do not treat as a standalone artifact command."
    },
    "/audit /fix /eachstep": {
      "phase": "flag",
      "read": ["kiwe-ai-toolkit/command-manifest.json"],
      "requires": ["/execute /stepbystep or /execute /fullflow"],
      "output": ["explicit audit/fix/re-audit loop after each phase before continuing"],
      "forbidden": ["standalone generation", "skipping re-audit after a fix"],
      "finalResponse": "Use as an execution flag. For each phase: generate/convert -> audit -> fix actual artifact if failed -> rerun same audit -> repeat until PASS or NEEDS_INPUT."
    },
    "/audit /atend": {
      "phase": "flag",
      "read": ["kiwe-ai-toolkit/command-manifest.json"],
      "requires": ["/execute /fullflow"],
      "output": ["final audit/fix gates before delivery"],
      "forbidden": ["standalone generation"],
      "finalResponse": "Use as an execution flag; do not treat as a standalone artifact command."
    },
    "/audit /fix /atend": {
      "phase": "flag",
      "read": ["kiwe-ai-toolkit/command-manifest.json"],
      "requires": ["/execute /fullflow"],
      "output": ["final audit/fix/re-audit gates before delivery"],
      "forbidden": ["standalone generation", "skipping re-audit after a fix"],
      "finalResponse": "Use as an execution flag. After generation/conversion, run required closure audits, fix failed lanes, and rerun the same audits until PASS or NEEDS_INPUT."
    },
    "/report": {
      "phase": "flag",
      "read": ["kiwe-ai-toolkit/command-manifest.json"],
      "requires": ["/execute /stepbystep or /execute /fullflow"],
      "output": ["compact generated/audited/fixed/warnings report"],
      "forbidden": ["creating documentation files", "long prose", "extra reports unless /document is also present"],
      "finalResponse": "In /execute /stepbystep, stop after the current phase closes, return the current phase file and compact report, then wait for human continue. In /execute /fullflow, include a compact final phase ledger only."
    },
    "/audit /allattached": {
      "phase": "audit",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json", "lane contexts and validators for every detected supplied artifact"],
      "requires": ["one or more current attached/supplied artifacts"],
      "output": ["pass/fail findings for every detected lane"],
      "forbidden": ["fixes unless /fix is also present", "creative rebuild", "redesign", "docs unless /document", "ZIP", "stale files"],
      "finalResponse": "Return compact PASS/FAIL/WARN per detected lane and next matching /fix command when needed."
    },
    "/fix /allattached": {
      "phase": "fix",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json", "lane contexts and validators for every failed supplied artifact"],
      "requires": ["current attached/supplied artifacts and failed audit findings or rerunnable validators"],
      "output": ["corrected current artifact files only"],
      "forbidden": ["creative rebuild", "redesign", "DSA/combined expansion unless already present", "docs unless /document", "ZIP", "stale files"],
      "finalResponse": "Return corrected files only plus compact audit status after rerunning every matching lane audit."
    },
    "/audit /allflow": {
      "phase": "audit",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json", "lane contexts and validators required by the detected start point/current stage"],
      "requires": ["classified current artifact or file map"],
      "output": ["pass/fail findings for every required closure audit"],
      "forbidden": ["fixes unless /fix is also present", "creative rebuild", "redesign", "docs unless /document", "ZIP", "stale files"],
      "finalResponse": "Return compact PASS/FAIL/WARN across all required closure audits for the detected flow."
    },
    "/fix /allflow": {
      "phase": "fix",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json", "lane contexts and validators required by failed closure audits"],
      "requires": ["classified current artifact/file map and failed audit findings or rerunnable validators"],
      "output": ["corrected canonical artifacts for the detected current flow"],
      "forbidden": ["creative rebuild", "redesign", "DSA/combined expansion unless already present or requested", "docs unless /document", "ZIP", "stale files"],
      "finalResponse": "Return corrected canonical artifacts only plus compact audit status after rerunning every required closure audit."
    },
    "/audit /previousoutput": {
      "phase": "audit",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json", "lane contexts and validators for every artifact in the immediate previous AI output"],
      "requires": ["files generated in the immediate previous AI output in this same session"],
      "output": ["pass/fail findings for every detected lane in the previous output"],
      "forbidden": ["fixes unless /fix is also present", "creative rebuild", "redesign", "docs unless /document", "ZIP", "stale files", "searching downloads or old conversations"],
      "finalResponse": "Audit only the immediate previous AI output files. If unavailable, stop with ERROR: KIWE_PREVIOUS_OUTPUT_MISSING."
    },
    "/fix /previousoutput": {
      "phase": "fix",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json", "lane contexts and validators for failed artifacts in the immediate previous AI output"],
      "requires": ["files generated in the immediate previous AI output in this same session"],
      "output": ["corrected files for the previous output only"],
      "forbidden": ["creative rebuild", "redesign", "new lane creation", "docs unless /document", "ZIP", "stale files", "searching downloads or old conversations"],
      "finalResponse": "Fix only the immediate previous AI output files and rerun matching audits. If unavailable, stop with ERROR: KIWE_PREVIOUS_OUTPUT_MISSING."
    },
    "/audit /allattached /allflow": {
      "phase": "audit",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json", "lane contexts and validators for every detected supplied artifact and every required closure audit"],
      "requires": ["current attached/supplied artifacts or file map"],
      "output": ["pass/fail findings per detected artifact lane and per required closure audit"],
      "forbidden": ["fixes unless /fix is also present", "creative rebuild", "redesign", "docs unless /document", "ZIP", "stale files"],
      "finalResponse": "Return compact PASS/FAIL/WARN for every detected artifact and every required closure audit."
    },
    "/fix /previousaudit": {
      "phase": "fix",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json", "lane contexts and validators referenced by the immediately previous audit findings"],
      "requires": ["immediately previous audit findings and current artifact files"],
      "output": ["corrected files for the previously audited failed lanes only"],
      "forbidden": ["creative rebuild", "redesign", "new lane creation", "docs unless /document", "ZIP", "stale files", "fixing from memory without previous findings"],
      "finalResponse": "Return corrected files only plus compact status after rerunning the exact previous audit scope."
    },
    "/fix /previouspass": {
      "phase": "diagnostic",
      "read": ["kiwe-ai-toolkit/entry.json", "kiwe-ai-toolkit/command-manifest.json"],
      "requires": ["current artifacts and immediately previous audit findings if the human wants a fix"],
      "output": ["ERROR: KIWE_PREVIOUS_AUDIT_MISSING when no previous audit findings exist"],
      "forbidden": ["execution", "silent aliasing", "fixing from memory", "stale files"],
      "finalResponse": "Do not execute. Explain that the canonical command is /fix /previousaudit and suggest /audit /allattached /allflow first when no previous audit findings exist."
    },
    "/create /designcontextenhancement": {
      "phase": "design-context-enhancement",
      "read": ["kiwe-ai-toolkit/contexts/dynamic-lite.md", "the attached kiwe.sitegraph-design-context.v1 export and its embedded designContextEnhancementContract"],
      "requires": ["a current kiwe.sitegraph-design-context.v1 export containing ownerContextHash and designContextEnhancementContract"],
      "must": ["copy the exact sourceContextHash", "set authority.mayOverwriteOwnerEvidence to false", "preserve every locked path and owner-selected color", "suggest colors only for semantic roles the owner left empty", "keep factual claims grounded in owner/SiteGraph evidence", "put uncertainty in requiresHumanReview"],
      "output": ["kiwe-design-context-enhancement.json using schema kiwe.design-context-enhancement.v1"],
      "forbidden": ["overwriting owner evidence", "inventing contacts addresses products legal facts awards or dates", "meta keywords", "keyword stuffing", "Bricks JSON", "automatically enabling Seam Framework", "browser-AI-authored production Framework Profile"],
      "finalResponse": "Return the enhancement JSON only plus compact locked/preserved/review counts. The administrator imports it in Kiwe > Framework."
    },
    "/seamframework": {
      "phase": "framework",
      "read": ["kiwe-ai-toolkit/contracts/seam-compiler-contract.json", "kiwe-ai-toolkit/contexts/seam-compiler-lite.md", "kiwe-ai-toolkit/contexts/bricks-conversion-lite.md"],
      "requires": ["successful raw SEAM Compiler conversion result or project batch"],
      "must": ["run the deterministic SEAM Compiler Framework stage; do not ask browser AI to rewrite the design", "emit one project-wide Framework Profile before dependent templates", "move body, H1-H6, link and site background ownership into Bricks Theme Style", "move repeated values/classes into universal or project profile layers", "keep genuine one-off exceptions element-native", "keep scoped CSS only where Bricks 2.3.10 lacks a faithful native control", "require the profile to be pushed in Kiwe > Framework before importing templates"],
      "output": ["framework/kiwe-framework-profile.json", "framework/audit-seamframework.json", "bricks-template/[name]-template-upload.json"],
      "forbidden": ["source redesign", "AI-authored production JSON", "inline variable fallbacks", "duplicate Theme Style/class/element ownership", "DSA theme", "docs unless /document", "ZIP"],
      "finalResponse": "Return the Framework Profile first, dependent templates second, and compact executable proof."
    },
    "/convert /bricks /seamframework": {
      "phase": "framework",
      "read": ["kiwe-ai-toolkit/contracts/seam-compiler-contract.json", "kiwe-ai-toolkit/contexts/seam-compiler-lite.md", "kiwe-ai-toolkit/contexts/bricks-conversion-lite.md"],
      "requires": ["arbitrary HTML/CSS/JS project, folder, archive, or standalone document"],
      "must": ["run SEAM Compiler 0.13.0 in one-pass Framework mode", "capture raw rendered evidence before Framework ownership", "emit one project-wide Framework Profile before dependent templates", "emit an explicit install-order manifest", "run /audit /seamframework and require PASS at 100% integration"],
      "output": ["framework/kiwe-framework-profile.json", "framework/audit-seamframework.json", "manifest-seam-framework.json", "bricks-template/[name]-template-upload.json"],
      "forbidden": ["source redesign", "AI-authored production JSON", "inline variable fallbacks", "discarding raw compiler evidence before Framework mapping", "docs unless /document", "ZIP"],
      "finalResponse": "Return the audited one-pass package with profile-first install order."
    },
    "/rebuild /seamframework": {
      "phase": "compatibility",
      "aliases": ["/seamframework"],
      "read": ["kiwe-ai-toolkit/contracts/seam-compiler-contract.json", "kiwe-ai-toolkit/contexts/seam-compiler-lite.md"],
      "requires": ["raw HTML/CSS/JS or an existing raw conversion result"],
      "must": ["normalize this legacy command to deterministic raw /convert /bricks followed by optional /seamframework", "never manually rewrite source HTML or production Bricks JSON"],
      "output": ["framework/kiwe-framework-profile.json", "bricks-template/[name]-template-upload.json"],
      "forbidden": ["legacy regex/token substitution as production authority", "AI-authored production JSON", "source redesign", "docs unless /document", "ZIP"],
      "finalResponse": "Report that the legacy command was normalized to Convert then Framework and return executable proof."
    },
    "/audit /seamframework": {
      "phase": "audit",
      "read": ["kiwe-ai-toolkit/contracts/seam-compiler-contract.json", "kiwe-ai-toolkit/contexts/seam-compiler-lite.md", "kiwe-ai-toolkit/contexts/bricks-conversion-lite.md"],
      "requires": ["Framework Profile plus every dependent Bricks template"],
      "output": ["framework/audit-seamframework.json", "pass/fail findings only"],
      "must": ["execute validate-seamframework.cjs or the SEAM Compiler package audit; never reuse the older raw-page adoption audit for a Framework package", "require status PASS and integration 100", "verify profile-before-template install order", "verify every consumed variable and reusable class is defined by the profile", "verify profile class IDs exactly match every dependent template _cssGlobalClasses reference", "fail duplicate Theme Style/project-class/element visual ownership", "fail local H1-H6 locks that should inherit Bricks Theme Style", "compare the raw and Framework templates to prove no redesign", "include validator proof in any PASS response"],
      "forbidden": ["manual-only PASS", "copied/reconstructed validator PASS", "fixes unless /fix is also present", "docs unless /document", "ZIP"],
      "finalResponse": "PASS/FAIL/INCOMPLETE with package proof, blocking errors, warnings, and install order."
    },
    "/fix /seamframework": {
      "phase": "fix",
      "read": ["kiwe-ai-toolkit/contexts/workflow-lite.md", "kiwe-ai-toolkit/contexts/seam-attributes-lite.md", "kiwe-ai-toolkit/tools/validate-seamframework.cjs"],
      "requires": ["failed Seam page artifact and audit findings"],
      "output": ["website/bricks-paste.html"],
      "must": ["fix the actual Seam page artifact", "move visual CSS off bare seam-* selectors and onto project-owned classes", "rerun the same Seam validator until PASS or NEEDS_INPUT"],
      "forbidden": ["Bricks JSON", "DSA theme", "redesign", "docs unless /document", "ZIP"],
      "finalResponse": "Return fixed Seam page artifact and compact validator-proof status."
    },
    "/create /frameworkprofile": {
      "phase": "create",
      "read": ["kiwe-ai-toolkit/contexts/workflow-lite.md"],
      "requires": ["explicit approved foundation tokens for a new blank profile, or deterministic SEAM Compiler evidence for a converted project"],
      "output": ["framework/kiwe-framework-profile.json"],
      "must": ["for converted HTML/CSS/JS use /convert /bricks /seamframework; do not infer an importable profile from screenshots, prose, or serialized Bricks alone", "run the official framework-profile generator and validate-framework-profile.cjs, Kiwe MCP, or Kiwe REST validator before PASS", "official Kiwe universal values go in settings.tokens.overrides", "project-specific variables/classes required by Bricks templates go in settings.tokens.project and are pushed to dedicated Kiwe Project categories in Bricks"],
      "forbidden": ["browser-AI-authored production profile inferred from a converted webpage", "manual-only PASS", "Bricks template JSON", "DSA theme package", "docs unless /document", "ZIP"],
      "finalResponse": "Return the deterministically generated profile and executable validation status; otherwise return WARN/UNVERIFIED and route converted projects to /convert /bricks /seamframework."
    },
    "/audit /frameworkprofile": {
      "phase": "audit",
      "read": ["kiwe-ai-toolkit/contexts/workflow-lite.md"],
      "requires": ["framework/kiwe-framework-profile.json"],
      "output": ["pass/fail findings only"],
      "must": ["reject custom token names in overrides", "allow project-specific variables/classes only in settings.tokens.project", "verify project variable/class names are prefixed and collision-safe"],
      "forbidden": ["fixes unless /fix is also present", "docs unless /document", "ZIP"],
      "finalResponse": "PASS/FAIL with blocking errors and warnings."
    },
    "/fix /frameworkprofile": {
      "phase": "fix",
      "read": ["kiwe-ai-toolkit/contexts/workflow-lite.md"],
      "requires": ["framework profile file and audit findings"],
      "output": ["framework/kiwe-framework-profile.json"],
      "forbidden": ["Bricks template JSON", "DSA theme package", "docs unless /document", "ZIP"],
      "finalResponse": "Return fixed profile and compact pass/fail summary."
    },
    "/create /brickstheme": {
      "phase": "create",
      "read": ["kiwe-ai-toolkit/contexts/workflow-lite.md"],
      "requires": ["approved design token/style direction"],
      "output": ["bricks-theme-style.json"],
      "forbidden": ["Framework profile", "Bricks page/template JSON", "DSA theme package", "docs unless /document", "ZIP"],
      "finalResponse": "Return only the Bricks theme style JSON and validation status."
    },
    "/convert /bricks": {
      "phase": "convert",
      "read": ["kiwe-ai-toolkit/contracts/seam-compiler-contract.json", "kiwe-ai-toolkit/contexts/seam-compiler-lite.md", "kiwe-ai-toolkit/contexts/bricks-conversion-lite.md"],
      "requires": ["arbitrary HTML/CSS/JS project, folder, archive, or standalone document"],
      "must": ["run SEAM Compiler 0.13.0 or a compatible deterministic compiler endpoint; browser AI must not author production JSON", "keep raw conversion Framework-neutral", "discover arbitrary pages without home/shop route assumptions", "split a complete standalone document into header, footer and content templates when applicable", "preserve source defects as 1:1 parity instead of redesigning them", "use Bricks-native element controls before scoped CSS", "preserve authored classes, attributes, interactions and executable behavior only within the compiler safety contract", "when live Bricks proof is used, reject stale page CSS, mismatched viewport provenance and foreign overlay contamination before scoring"],
      "output": ["bricks-template/[page-or-template-name]-template-upload.json"],
      "targetTypes": {
        "homepageBody": "title Home, templateType content, content[]",
        "pageBody": "templateType content, content[]",
        "header": "templateType header, header[]",
        "footer": "templateType footer, footer[]",
        "section": "templateType section, content[]"
      },
      "forbidden": ["mandatory Framework Profile", "automatic Seam token/class injection", "AI-authored production JSON", "project-specific compiler rules", "Code element fallback when native Bricks elements are possible", "docs unless /document", "ZIP"],
      "finalResponse": "Return every discovered raw native Bricks template and compact executable conversion proof."
    },
    "/audit /bricksconversion": {
      "phase": "audit",
      "read": ["kiwe-ai-toolkit/contracts/seam-compiler-contract.json", "kiwe-ai-toolkit/contexts/seam-compiler-lite.md", "kiwe-ai-toolkit/contexts/bricks-conversion-lite.md"],
      "requires": ["raw source plus native Bricks template upload JSON or compiler proof bundle"],
      "must": ["run executable structural/native-coverage validation", "treat the source as the visual contract even when it contains its own responsive defect", "require equal viewport provenance before any visual percentage", "mark mismatched canvas, DPR, page identity, scrollbar geometry, stale target CSS, or foreign overlay contamination INCOMPLETE", "report native coverage and scoped CSS exceptions separately", "fail runtime Code elements unless explicitly marked review-only unsupported exceptions", "fail framework-dependent settings in raw mode"],
      "output": ["pass/fail findings only"],
      "forbidden": ["fixes unless /fix is also present", "docs unless /document", "ZIP"],
      "finalResponse": "PASS/FAIL/INCOMPLETE with executable proof, valid visual score when available, blocking errors, and warnings."
    },
    "/fix /bricksconversion": {
      "phase": "fix",
      "read": ["kiwe-ai-toolkit/contexts/bricks-conversion-lite.md", "kiwe-ai-toolkit/contexts/seam-attributes-lite.md"],
      "requires": ["failed Bricks conversion/template artifact"],
      "must": ["fix the Bricks artifact itself; do not claim a Framework profile will repair hardcoded template JSON later", "use official tokens first, declared project variables second, and real fluid clamps only when source responsive states prove different min/max values"],
      "output": ["fixed Bricks conversion/template artifact only"],
      "forbidden": ["DSA/AppShell conversion", "website redesign", "docs unless /document", "ZIP"],
      "finalResponse": "Return fixed artifact and compact pass/fail summary."
    },
    "/accessibility": {
      "phase": "accessibility-current-artifact",
      "read": ["kiwe-ai-toolkit/contexts/accessibility-lite.md"],
      "requires": ["current page, preview, artifact, or file map; the active /ideate page qualifies"],
      "output": ["SEAM automated accessibility score with automated coverage", "manual checks listed outside the score", "minimal same-lane repairs when needed"],
      "forbidden": ["forcing Seam Framework", "forcing Bricks conversion", "generic redesign", "dark-mode inversion", "unmeasured compliance claims", "ZIP"],
      "finalResponse": "Return score/evidence, files changed, structural drift, and remaining manual checks."
    },
    "/create /accessibility": {
      "phase": "create",
      "read": ["kiwe-ai-toolkit/contexts/accessibility-lite.md", "kiwe-ai-toolkit/contexts/seam-attributes-lite.md"],
      "requires": ["existing website/page, DSA theme, combined handoff, Framework profile, Bricks theme style, or Bricks conversion"],
      "output": ["accessibility/kiwe-accessibility-plan.json", "minimal existing artifact edits when needed for dark/light proof"],
      "forbidden": ["new page design", "Bricks reconversion", "DSA theme creation", "docs unless /document", "ZIP"],
      "finalResponse": "Return plan/artifact file(s) and compact pass/fail summary."
    },
    "/audit /accessibility": {
      "phase": "audit",
      "read": ["kiwe-ai-toolkit/contexts/accessibility-lite.md"],
      "requires": ["existing artifact files and optional accessibility/kiwe-accessibility-plan.json"],
      "output": ["pass/fail findings only"],
      "forbidden": ["fixes unless /fix is also present", "docs unless /document", "ZIP"],
      "checks": ["WCAG contrast", "native light/dark proof", "Kiwe/Seam token pairs", "Bricks theme-style alignment", "critical text clipping/overflow", "Appsite capability attributes preserved"],
      "finalResponse": "PASS/FAIL with blocking errors and warnings."
    },
    "/fix /accessibility": {
      "phase": "fix",
      "read": ["kiwe-ai-toolkit/contexts/accessibility-lite.md", "kiwe-ai-toolkit/contexts/seam-attributes-lite.md"],
      "requires": ["failed accessibility audit or existing artifact needing accessibility repair"],
      "output": ["revised existing artifact file(s)", "accessibility/kiwe-accessibility-plan.json"],
      "forbidden": ["new Bricks elements unless explicitly required and explained", "new classes unless official/project-token mapping cannot solve the failure", "removed Seam classes", "removed Kiwe/Appsite attributes", "DSA/AppShell structure changes", "Bricks reconversion", "website redesign", "docs unless /document", "ZIP"],
      "preserve": ["element counts where possible", "global class counts where possible", "global variable names unless adding documented accessibility token mappings", "Seam classes", "data-role/data-flow", "data-kiwe-* attributes", "data-dsa-* attributes", "Bricks dynamic tags", "query-loop intent"],
      "darkModeRecipe": {
        "sourceOfTruth": "Use this recipe; do not search repo docs for a separate dark-mode contract.",
        "selectorPattern": [
          ".page-root-class, [data-kiwe-theme=\"light\"] .page-root-class, html[data-brx-theme=\"light\"] .page-root-class, :root[data-brx-theme=\"light\"] .page-root-class",
          "html[data-kiwe-theme=\"dark\"] .page-root-class, [data-kiwe-theme=\"dark\"] .page-root-class, .page-root-class[data-kiwe-theme=\"dark\"], html[data-brx-theme=\"dark\"] .page-root-class, :root[data-brx-theme=\"dark\"] .page-root-class"
        ],
        "bricksCompatibility": "When the target Bricks site exposes frontend color mode, Bricks may set document.documentElement.dataset.brxTheme on the frontend and emit palette variables at :root plus :root[data-brx-theme=\"dark\"]. Bricks-ready accessibility fixes must support data-brx-theme alongside Kiwe data-kiwe-theme when available; do not rely on Bricks editor dark UI alone.",
        "requiredKiweTokens": [
          "--kiwe-color-surface",
          "--kiwe-color-surface-raised",
          "--kiwe-color-surface-sunken",
          "--kiwe-color-text",
          "--kiwe-color-text-muted",
          "--kiwe-color-text-inverse",
          "--kiwe-color-border",
          "--kiwe-color-brand",
          "--kiwe-color-accent"
        ],
        "rule": "Remap existing project variables such as --nc-paper, --nc-surface, --nc-ink, --nc-muted, --nc-line, --nc-brand, and --nc-accent to Kiwe tokens for light and dark states. Do not invent a second unrelated palette."
      },
      "checks": ["WCAG contrast", "native light/dark proof", "Kiwe/Seam token pairs", "Bricks theme-style alignment", "critical text clipping/overflow", "reduced motion when motion exists"],
      "finalResponse": "Return fixed file(s), PASS/FAIL/WARN, files changed, and structural-drift summary. Keep it compact."
    },
    "/document": {
      "phase": "document",
      "read": ["context for the already completed command lane"],
      "requires": ["existing artifact"],
      "output": ["the narrow notes/report file for that lane"],
      "forbidden": ["redesign", "rebuild", "conversion", "theme creation", "ZIP unless explicitly requested"],
      "finalResponse": "Return the requested documentation file and compact summary."
    }
  }
}
