Work in Codeflow as a contract-first engineering agent:
- keep diffs small and auditable
- keep code and docs in sync
- verify behavior with real commands before claiming success
- never commit runtime caches, local secrets, logs, or generated noise
README.mddocs/index.htmlconfigs/repo_positioning.jsonconfigs/docs_nav_registry.json- nearest local wrapper under
apps/*/AGENTS.mdorapps/*/CLAUDE.md
- bootstrap:
npm run bootstrap - local fast CI:
npm run ci - local strict CI:
npm run ci:strict - fast verification:
npm run test:quick - main local gate:
npm run test - host safety scan:
npm run scan:host-process-risks - space audit:
npm run space:audit - docker runtime audit:
npm run docker:runtime:audit - hygiene:
bash scripts/check_repo_hygiene.sh - workflow security:
npm run scan:workflow-security - Trivy repo scan:
npm run scan:trivy - closeout secret scan:
npm run security:scan:closeout - truth split:
npm run truth:triage - full pre-commit:
pre-commit run --all-files - repo-owned
scripts/*.pyentrypoints must remain runnable through directpython3 scripts/<name>.pyexecution orbash scripts/run_governance_py.shwithout relying on a pre-seeded repo-rootPYTHONPATH - host-compatible pre-commit hooks that execute repo-owned
scripts/*.pyentrypoints must use the same wrapper path (or an equivalentpython3 -Bcontract) so clean hook runs do not leave repo-local__pycache__residue
- active CI layers:
pre-commit,pre-push,hosted,nightly,manual - do not reintroduce a sixth CI/profile/workflow layer; move scheduled heavy checks to
nightlyand explicit high-cost verification tomanual
- trust flow:
ci-trust-boundary -> quick-feedback -> hosted policy/core slices -> pr-release-critical-gates -> pr-ci-gate - hosted policy/core slices:
policy-and-security, core-tests - untrusted PR path:
quick-feedback -> untrusted-pr-basic-gates -> pr-ci-gate - protected sensitive lanes:
workflow_dispatch -> owner-approved-sensitive -> ui-truth / resilience-and-e2e / release-evidence - canonical machine SSOT:
configs/ci_governance_policy.json
- authoritative release-truth builders must consume
.runtime-cache/codeflow/reports/ci/current_run/source_manifest.json. - the live current-run authority verdict belongs to
python3 scripts/check_ci_current_run_sources.pyand.runtime-cache/codeflow/reports/ci/current_run/consistency.json. - current-run builders:
artifact_index/current_run_index,cost_profile,runner_health,slo,portal,provenance. - docs and wrappers must not hand-maintain live current-run status; they must point readers back to the checker receipts.
- if the current-run source manifest is missing, authoritative current-run reports must fail closed or run only in explicit advisory mode.
- repo coverage snapshot unavailable
- run
npm run coverage:repoto refresh this fragment.
- update tests when behavior changes
- update docs when commands, APIs, or public behavior change
- keep public docs English-first and minimal
- anchor root AI entrypoints to public routes, config manifests, and receipts
instead of archived internal markdown under
docs/ - keep runtime output under
.runtime-cache/ - keep public test/probe fixtures free of maintainer-local absolute paths and
raw token-shaped literals; use generic workspace roots plus synthetic string
assembly instead, keep placeholder security URIs constrained to the exact
example.comcontract, preserve.jsonltemp-report hints in portable scan scratch names, fail closed on tracked direct email/phone markers plus forbidden runtime files, fail closed on open GitHub secret/code scanning alerts in local hooks and pre-push while GitHub-hostedtrusted_pr,untrusted_pr, and hosted-firstpush_mainQuick Feedback / hosted policy lanes stay advisory under integration-token and first-analysis timing limits, keep workflow static security (actionlint+zizmor), canonical secret scanning, and Trivy dependency scanning wired into repo-owned entrypoints, and sync the root/docs entrypoints when that hygiene contract changes - treat Chrome/Chromium/Playwright/Safari/browser profiles as machine-shared resources: use repo-scoped or ephemeral state only, never reuse tabs/windows/profiles opened by other repos or other L1s, and close browser sessions when the current verification pass ends
- prefer background/no-focus browser verification paths whenever possible; do not steal desktop focus unless the current workflow truly requires a visible foreground browser step
- before opening a new Chrome/Chromium-class browser instance, check current machine browser load; if more than 6 browser instances are already running, wait for other repo workers to release resources instead of opening another
- treat a missing login/session as a blocker after 1-2 repo-scoped attempts; do not keep spawning fresh browsers or profile clones once the current repo's real profile is confirmed logged out
- clean repo-owned browser temp state and Docker residue after verification: do not leave cloned browser profiles, idle tabs, orphaned Chromium instances, or repo-owned Docker containers/images/volumes/caches behind; if cleanup cannot happen immediately, record the residue, owner, and reason in the active task board
- host-process safety is fail-closed:
worker-safeis the default mode, and worker/test/orchestrator paths must never usekillall,pkill,killpg(...), process-group kills, negative/zero PID signals,loginwindow/ Force Quit APIs, or AppleScriptSystem Events; terminate only the recorded child handle or another exact repo-owned positive-PID record, and if stale repo-owned runtime state is already present, stop with manual cleanup instructions instead of broad process cleanup - detached browser/runtime launch is review-required only and must stay inside repo-owned browser roots or directly held child handles
- never perform write actions against external accounts or dashboards (GitHub settings, Render apply/deploy, npm publish, marketplace submission, browser-clicked account mutations) unless the user explicitly authorizes that exact class of write
- prefer repo-owned scripts over ad-hoc shell glue
- keep public CI hosted-first: fork PRs stay low-privilege on GitHub-hosted lanes, and sensitive verification stays on protected manual dispatch lanes
- GitHub repo-first pushes may supply the all-zero base SHA; repo-owned
doc-drift/doc-sync gates must skip
ci-diffcomparison in that case instead of failing before the repository has any real comparison baseline - treat
configs/github_control_plane_policy.jsonas the machine SSOT for required check names, and reuse the rootREADME.mdrequired-check summary instead of restating the names here GitHub Control Planeworkflow should prefer the repo secretGH_ADMIN_TOKENwhen it needs to prove admin-only repository APIs, because the default workflow token cannot read Actions permissions, branch protection, or vulnerability-alert endpoints on the live control plane- when dashboard dependency lock refreshes land, update
apps/dashboard/pnpm-lock.yamltogether with the rootpackage.json/pnpm-lock.yamlchange set and sync the dashboard-facing docs - the current security-only dashboard/root lock refresh keeps
lodash-es@4.18.1pinned through the repo-owned override layer solighthouse@13.0.3does not drift back onto the vulnerablelodash-es@4.17.23transitive path, without forcing a broader Lighthouse upgrade just to clear the tracked alerts - when dashboard or desktop transitive security fixes change the maintained lock surfaces, sync the root AI/docs entrypoints in the same change set so doc-sync gates stay aligned with the live maintenance contract
- when closeout work lands across both dashboard and desktop packaging surfaces, update the root entrypoint docs in the same patch instead of relying only on module-local README changes
- when the live public GitHub surface moves or changes repository URLs, sync the
root docs/security/storefront entrypoints in the same patch so repo-side
links do not drift behind the published
Codeflowsurface - when security reporting wording changes, keep
SECURITY.md,SUPPORT.md, issue template contact links, and the root README aligned in the same patch - when security-scan or fixture-hygiene work changes tracked test literals or
scan wrappers, sync the root AI/docs entrypoints in the same patch; current
examples include replacing maintainer-local absolute paths with generic
workspace roots in public fixtures, building token-like samples from safe
fragments at runtime, and keeping
scripts/security_scan.shon BSD-safe temp-file naming so local macOS scans still start cleanly - when dashboard/operator wording or intake/runtime contracts change, sync the root AI/docs entrypoints in the same patch so doc-sync gates can trace the live English-first dashboard surface and the current intake/probe contracts
- when runtime-provider compatibility changes the orchestrator client contract,
sync the root AI/docs entrypoints in the same patch; current examples include
the Switchyard runtime-first
/v1/runtime/invokeadapter, the forcedchat_completionsmode on chat-only intake/operator paths, and the explicit fail-closed rule for MCP tool execution that still requires a tool-capable provider path; Quick Feedback-safe helper extraction, dead-code-cleanprovider_resolutioncompatibility exports, and env-governance allowlist updates for read-only runtime-capability summaries follow the same rule - when role-contract / prompt-ref / handoff-summary semantics change the
orchestrator contract or preview surfaces, sync the root AI/docs entrypoints
in the same patch; current examples include resolved
role_contract, intakerole_contract_summary, summary/risk-only handoff, and the governance-backed metadata inpolicies/agent_registry.jsonplusconfigs/env_direct_read_allowlist.json - when Prompt 4-style binding/read-surface work extends those role-contract
surfaces, keep the root AI/docs entrypoints aligned in the same patch;
current examples include contract-derived
role_binding_summaryin PM-facingrun_intake(...)responses plus the same summary persisted into run manifests, alongside registry-backed SEARCHER/RESEARCHERmcp_bundle_refhardening inpolicies/agent_registry.json - when CI maintenance changes the Python dependency audit contract or the
tracked runtime report namespaces, sync the root AI/docs entrypoints in the
same patch; current examples include
.runtime-cache/test_output/ci/andconfigs/pip_audit_ignored_advisories.json, plus the dashboard and desktop install-time ENOSPC recovery knobs plus the Docker daemon precheck retry knobs registered inconfigs/env.registry.json, and the bounded transient npm registry socket-timeout retries insidescripts/install_dashboard_deps.shplusscripts/install_desktop_deps.sh; current CI credential/evidence examples also include the upstream receipt refresh fallback toscripts/verify_upstream_slices.py --mode smokeand the strict live-provider rule that resolves process env first and~/.codex/config.tomlsecond while keeping dotenv and shell-export fallbacks disabled on mainline; staged dashboard UI-audit workspaces must also keep package-local frontend sources inside the temporary workspace root instead of relying on out-of-root symlinks that Turbopack rejects, and repeated pnpmERR_PNPM_ENOENTrecovery should escalate to workspace-local store recovery instead of repeating the same failing fresh-store copy path - when runtime retention and space-governance contracts change, sync the root
AI/docs entrypoints in the same patch; current examples include
log_lane_summary+space_bridgeinretention_report.json, serial-only heavy cleanup execution ordering, cleanup inventory consistency checks, and the rule that repo-external apply scope stays inside~/.cache/codeflowwhile shared observation layers remain report-only; current machine-temp examples also include~/.cache/codeflow/tmp/docker-ci/runner-temp-*,~/.cache/codeflow/tmp/clean-room-machine-cache.*, and~/.cache/codeflow/tmp/clean-room-preserve.*, which stay repo-external-related under wave3 instead of defaulting to DarwinTMPDIR; current closeout slices also includemachine_cache_summary+machine_cache_auto_prunein the retention/space-governance bridge, the repo-owned Docker runtime receipt at.runtime-cache/codeflow/reports/space_governance/docker_runtime.json, repo-owned buildx local cache under~/.cache/codeflow/docker-buildx-cache/, plus the repo-owned singleton Chrome root under~/.cache/codeflow/browser/chrome-user-data/thatallow_profilenow attaches to over the fixed CDP endpoint instead of reusing the default Chrome root; CI / docker / clean-room lanes still fail closed back toephemeral - when workflow-case / proof-pack / compare / task-pack / queue-scheduling
contracts change, sync the root AI/docs entrypoints in the same patch; the
current examples are
.runtime-cache/codeflow/workflow-cases/,proof_pack.json, dedicated run-compare surfaces, desktop Flight Plan preview, and timezone-safe queue scheduling inputs - when Version B closeout work changes the public front door, shared locale
substrate, read-only MCP exposure, or operator-copilot surfaces, sync
README.md,docs/index.html,configs/docs_nav_registry.json,apps/orchestrator/README.md, and the root AI entrypoints in the same patch so doc-drift and doc-sync gates can trace the same Command Tower / Workflow Cases / Proof & Replay contract - when ecosystem-binding, builder-entrypoint, or distribution-facing surfaces
change, sync the root AI/docs entrypoints in the same patch; current examples
include
configs/docs_nav_registry.json, the package-facingfrontend-api-client/frontend-sharedREADMEs, and the dashboard home/docs landing sections that explain Codex / Claude Code / read-only MCP plus the first-run -> proof -> share loop - when a follow-up builder/adoption slice adds a legal contract-package guide
or surfaces integrations/skills adoption more directly on the dashboard home,
sync the root AI/docs entrypoints in the same patch; current examples include
packages/frontend-api-contract/README.md, the dashboard-home integrations section inapps/dashboard/components/DashboardHomeStorySections.tsx, and the docs-base resolver now honoring/integrations/and/skills/ - when a later ecosystem-adoption slice adds copy-paste starter kits or
ecosystem-native example configs, sync the root AI/docs entrypoints in the
same patch; current examples include
docs/agent-starters/index.html,examples/coding-agents/README.md, the shared read-only MCP example underexamples/coding-agents/mcp/, and the local plugin-bundle manifests underexamples/coding-agents/plugin-bundles/that stay explicitly starter-only rather than official marketplace artifacts - when a later Phase 2 wave adds dedicated public sub-entrypoints (for example
/ecosystem/,/builders/,/use-cases/,/compatibility/) or moves additional dashboard home hero/ecosystem/AI/builder copy into the shared locale substrate, sync the root AI/docs entrypoints in the same patch so doc-sync gates can trace the new discoverability surfaces without guessing - when a follow-up Phase 2 wave adds a public
AI + MCP + APIhub or makes the dashboard-home locale toggle drive server-rendered copy through cookie-backed preference sync, update the root AI/docs entrypoints and release-facing docs in the same patch so doc-sync gates can trace both the discoverability layer and the locale-contract change; current examples includedocs/ai-surfaces/index.html, the extractedapps/dashboard/components/DashboardHomeStorySections.tsxnarrative surface, and the AI Work Command Tower wording shared by the dashboard metadata and the public Pages front door - when that same wave also extracts dashboard-home story sections into a
dedicated shared-copy component, keep this root guide,
CLAUDE.md, andCHANGELOG.mdaligned in the same patch so quick-feedback gates can trace the new locale-aware rendering path instead of guessing from page-local code - keep the root wording aligned when the dashboard home starts mixing cookie-backed locale SSR with client-side locale refresh, because that split is easy to miss in page-only diffs
- the current concrete examples are
docs/ai-surfaces/index.html,apps/dashboard/components/DashboardHomeStorySections.tsx,packages/frontend-shared/uiLocale.ts, and dashboard metadata that now says "AI Work Command Tower for Codex, Claude Code, and MCP" - when the next Phase 2 wave hardens desktop
Run Detail/Overviewoperator wording through the shared locale and shared status-presentation substrate, sync the root AI/docs entrypoints in the same patch; current examples includeapps/desktop/README.md,packages/frontend-shared/uiCopy.ts, and the locale-aware desktop tests forRunDetailPage/OverviewPage - when a later Phase 2 wave hardens desktop
Run Detail/Overviewoperator-surface locale coverage or moves more desktop strings onto@codeflow/frontend-shared, keep the root AI entrypoints aligned in the same patch; current examples include locale-aware desktop status labels, shared-copy Run Detail table/action chrome, and zh-CN regression coverage - when a front-door discoverability wave adds or reprioritizes public
integration/skills/SEO entrypoints, sync the root AI/docs entrypoints in the
same patch; current examples include
docs/integrations/index.html,docs/compatibility/index.html,docs/skills/index.html,docs/robots.txt,docs/sitemap.xml, the docs-navigation registry move that now treats ecosystem/use-cases/AI/MCP/API/builders/compatibility as primary public entrypoints instead of supplemental side doors, and the skills quickstart CTA shift toward in-page adoption/maintainer anchors instead of a dead public-repo tree link - when dashboard route-level discoverability or Workflow Case list locale
coverage changes, sync the root AI/docs entrypoints in the same patch;
current examples include route metadata on
apps/dashboard/app/command-tower/page.tsx,apps/dashboard/app/workflows/page.tsx, andapps/dashboard/app/workflows/[id]/page.tsx, plus the shared-copy workflow list substrate now carried throughpackages/frontend-shared/uiCopy.ts, and the matching metadata/locale regression coverage inapps/dashboard/tests/command_tower_page_ssr_query_repro.test.ts,apps/dashboard/tests/workflow_detail_page.test.tsx, andapps/dashboard/tests/workflows_queue_page.test.tsxpackages/frontend-shared/uiCopy.js - when dashboard home discoverability grows a new integrations/skills adoption
layer or package-contract CTA path, sync the root AI/docs entrypoints in the
same patch; current examples include
apps/dashboard/components/DashboardHomeStorySections.tsx, the public-docs resolver allowlist inapps/dashboard/lib/env.ts, the matching env/home regression coverage, and the repo-ownedpackages/frontend-api-contract/README.mdguide that now sits between the public API quickstart and the raw generated.d.tsfiles - when a later discoverability wave adds a public compatibility/adoption
matrix, sync the root AI/docs entrypoints in the same patch; current
examples include
docs/compatibility/index.html,configs/docs_nav_registry.json,docs/sitemap.xml,apps/dashboard/lib/env.ts, and the dashboard-home integration layer now pointing teams toward a compatibility ladder before they choose protocol, skills, builders, or proof-first onboarding - when a follow-up discoverability wave adds public copy-paste starter kits or
local bundle examples for Codex / Claude Code / OpenClaw, sync the root
AI/docs entrypoints in the same patch; current examples include
docs/agent-starters/index.html,docs/examples/agent-starters/,examples/coding-agents/,configs/root_allowlist.json, and the root/docs wording that now distinguishes host-platform plugin reality from Codeflow's own publication state - when a later polish wave compresses the public homepage or dashboard-home discovery stack into a clearer route page, sync the root AI/docs entrypoints in the same patch; current examples include the homepage mini-nav, reduced hero CTA set, compatibility-first routing, and the dashboard-home adoption layer consolidating ecosystem / integrations / AI / builders into one smaller decision surface
- when a follow-up CTA polish slice changes that dashboard adoption layer
again, sync the root AI/docs entrypoints in the same patch; current examples
include keeping
/compatibility/as the main routing card, restoring a lighter/use-cases/proof-first side door, and updating the adoption-nav accessibility label so the dashboard no longer advertises the old integration-only action group - when the next Phase 2 wave deepens public
MCP/APIdiscoverability, sync the root AI/docs entrypoints in the same patch; current examples includedocs/mcp/index.html,docs/api/index.html, the dashboard-home AI section CTA, and root navigation that points readers toward read-only MCP and API quickstarts without implying hosted/write-capable MCP - when Prompt 6-style skills-bundle and workflow/control-plane read-model work
lands, sync the root AI/docs entrypoints in the same patch; current examples
include
policies/skills_bundle_registry.json, enrichedrole_binding_summary.skills_bundle_refmetadata, andworkflow_case_read_modelon workflow/control-plane reads that stay explicitly non-authoritative - when a Prompt 7-style frontend slice projects those same read models onto
dashboard or desktop Workflow Case detail views, sync the root AI/docs
entrypoints in the same patch; current examples include the read-only
Workflow read modelcards onapps/dashboard/app/workflows/[id]/page.tsxandapps/desktop/src/pages/WorkflowDetailPage.tsx, plus the typed frontendRoleBindingReadModel/WorkflowCaseReadModelshapes that stay belowtask_contract - when a Prompt 8-style slice converges the OpenAPI/frontend-contract
generation chain or projects
role_binding_read_modelonto dashboard/desktop Run Detail surfaces, sync the root AI/docs entrypoints in the same patch; current examples includedocs/api/openapi.codeflow.json, the generated@codeflow/frontend-api-contractread-model types, and the read-only Run Detail operator summaries that keeptask_contractas execution authority - when a Prompt 9-style slice turns role / bundle / runtime truth into
dashboard/desktop
Agents+Contractsoperator catalog surfaces, sync the root AI/docs entrypoints in the same patch; current examples include the registry-backed/api/agentsrole catalog, the normalized/api/contractsinspector payload, and the same read-only authority/advisory wording carried through both web and desktop operator shells - when a Prompt 10-style slice turns those read-only catalog surfaces into a
repo-owned role-configuration control plane, sync the root AI/docs
entrypoints in the same patch; current examples include
policies/role_config_registry.json, the role-config preview/apply routes under/api/agents/roles/{role}/config*, the generated frontend contract bindings for those routes, and the rule thatAgentsbecomes the control desk whileContractsstays inspector-first andtask_contractremains the only execution authority - when a Prompt 10 follow-up slice adds derived runtime capability posture to
intake previews, run manifests, operator-copilot briefs, or the
dashboard/desktop
ContractsandRun Detailsurfaces, sync the root AI/docs entrypoints in the same patch; current examples include the derivedruntime_capability_summaryonexecution_plan_report, therole_binding_read_model.runtime_binding.capabilitysummary in generated frontend contracts, the shared dashboard/desktop runtime-capability copy, and the explicit fail-closed wording that keeps chat compatibility distinct from tool execution parity - when a Prompt 10 closeout fix changes how contract package entrypoints load
under CI/governance paths, sync the root AI/docs entrypoints in the same
patch; current examples include lazy-loading
codeflow_orch.contractsoContractValidatorand schedule-boundary governance checks stay below runtime-provider dependencies such ashttpxon Quick Feedback lanes - when a Prompt 10 Wave 3 slice hardens builder/client entrypoints into a
repo-owned starter path, sync the root AI/docs entrypoints in the same patch;
current examples include
packages/frontend-api-client/examples/control_plane_starter.local.mjs, the package-facingcreateControlPlaneStarter(...)bootstrap flow, and the rule that this starter remains below hosted SDK / marketplace claims - when dashboard dependency verification learns about new runtime-critical
packages for quick/clean-room lanes, sync the root AI/docs entrypoints in the
same patch; current examples include
scripts/install_dashboard_deps.shverifying thatjsdomitself loads successfully alongside Next/lighthouse toolchain checks so partial dashboard installs fail fast beforenpm run test:quickclaims a clean quick lane - when the Final-100 / Wave 4 follow-up slice adds hosted pilot readiness or
queue-first mutation groundwork, sync the root AI/docs entrypoints in the
same patch; current examples include
render.yaml,configs/docs_nav_registry.json, the hostedCODEFLOW_API_ALLOWED_ORIGINSenv wiring across.env.example,apps/orchestrator/.env.example,configs/env.registry.json, andconfigs/env_direct_read_allowlist.json, plus the rule thatapps/orchestrator/src/codeflow_orch/mcp_queue_pilot_server.pyand queue preview/cancel routes stay repo-owned operator groundwork rather than live hosted proof or public write-capable MCP - when a Final-100 hosted/operator follow-up only changes governance,
queue-pilot, or API posture files after the main public docs already moved,
still update
AGENTS.mdandCLAUDE.mdin the same patch so the ci-diff doc-sync gate sees the root AI navigation layer refresh on top ofconfigs/env_direct_read_allowlist.json,render.yaml, and the guarded queue preview/cancel operator surfaces instead of treating the change as logic-only drift - when staged dashboard smoke builds change their dependency-install or
apps/dashboard/lib/types.tsexport bridge semantics, sync the root AI/docs entrypoints in the same patch so pre-push and UI-audit gates can distinguish staging drift from real dashboard regressions - when clean-room recovery changes the package-local install order for
frontend-api-client, sync the root AI/docs entrypoints in the same patch so recovery gates fail on product regressions instead of missing local package installs - when clean-room recovery changes the ordering between workspace cleanup and
broad runtime deletion, sync the root AI/docs entrypoints in the same patch;
current examples include running
scripts/cleanup_workspace_modules.shbefore the clean-roomrm -rfsweep, plus quarantining stubborn dashboard module residue when recursive delete alone is not enough, so the recovery lane does not abort early on transient bind-mounted trees
apps/orchestrator/AGENTS.mdapps/dashboard/AGENTS.mdapps/desktop/AGENTS.md