This file gives Codex project-specific context for working in Dao Browser.
- Communicate with the user in Chinese.
- Write source code, comments, tests, commit messages, PR titles, and documentation in English unless the user explicitly asks otherwise.
- Do not embed non-English user-facing copy directly in code. User-visible text in any language must be provided through the appropriate internationalization system.
Dao Browser is a Chromium-based browser with an Arc-style vertical sidebar, currently targeting macOS arm64. The full Chromium checkout and build output live under engine/, which is gitignored and very large. This repository tracks Dao-owned code and patch files, not the whole Chromium tree.
Read docs/features.md first when asked what Dao Browser does, when locating the owner of a behavior, or before adding a feature that may overlap with existing work.
- When adding or materially changing a Dao Browser feature, update
docs/features.mdin the same change to keep the feature catalog current. - When adding or materially changing a Dao Browser feature, update
docs/feature-checklist.mdin the same change so Chromium upgrade and regression checks cover the new behavior. - If a feature change does not require updates to either document, explicitly mention why in the final response.
src/dao/contains Dao-owned C++ / WebUI / assets copied into Chromium during import.src/patches/contains unified diff patches against Chromium files. Patch paths mirrorengine/src/.engine/is generated / checked-out Chromium state. Read it for context or build errors, but do not edit it directly unless the latest user message explicitly asks you to do so.branding/contains brand assets used by the import pipeline.configs/anddao.jsondefine Chromium version, platform, GN args, and branding metadata.scripts/cli.tsis the single CLI entrypoint behind the npm scripts.website/is the standalone marketing/product website.
Treat src/dao/ and src/patches/ as canonical. If engine/ and tracked files disagree, trust the tracked files unless you are investigating a build failure.
- Never edit files under
engine/directly unless the latest user message explicitly asks for anengine/edit. Keep deliverable changes insrc/dao/,src/patches/, or other tracked Dao-owned sources. - Never run
autoninja,ninja,siso, or direct Chromium build tools. - Never run
gn gendirectly. - For compile confirmation, use only
npm run rebuild. Do not usenpm run build,npm run build:debug,npm run test:build, direct Chromium build tools, or any other compile path as a substitute. Other compile paths can lose or corrupt the warm Chromium build cache. - Do not use
npm run import -- --forceunless it is necessary. If force import is needed, ask the user for explicit confirmation first and explain why normalnpm run importis insufficient. - Never run bare
npm run export; always scope it withnpm run export -- <file>. - Never hand-edit generated vendor files under
src/dao/browser/ui/webui/resources/agent/vendor/. - Never invoke
i18n.shautomatically; it uses paid translation and overwrites files. - Do not create git worktrees or feature branches for this repository. Work in the primary checkout on
main. - Do not run state-changing git commands unless the latest user message explicitly authorizes the exact action.
State-changing git commands include git add, git commit, git push, git pull, git reset, git rebase, git checkout when it discards changes, git stash, git tag, git merge, git cherry-pick, git restore, and git apply against the repo root. Read-only git commands such as git status, git diff, git log, git show, git branch, and git blame are allowed.
npm run setup # First-time setup: download Chromium and apply patches
npm run import # Apply patches and copy src/dao into engine
npm run rebuild # The only allowed compile-confirmation command
npm run test # Full Dao test sweep; use only when broad coverage is needed
npm run test:build # Build browser_tests only; never use for compile confirmation
npm run test:webui # Run Vitest WebUI tests
npm run lint:lit # Check Lit reactive fields
npm run vendor # Regenerate WebUI vendor bundles
npm run vendor:check # Verify generated vendor bundles
npm run start # Launch release app
npm run start:debug # Launch debug app with stderr loggingChromium builds are expensive. Batch related C++, header, BUILD.gn patch, resource, and test edits before building. When you need to confirm compilation, run npm run rebuild and no other build command, because alternate compile paths can lose the incremental build cache.
- Add Dao-owned files under
src/dao/. - Update Chromium integration through
src/patches/**/*.patch. - Run
npm run importto apply patches intoengine/src/. - Prefer plain
npm run import. Usenpm run import -- --forceonly when the existingengine/srcpatch state must be reset and reapplied, and only after the user explicitly confirms that force import is allowed. - Do not hand-edit
engine/src/to sync patch changes. Update the canonical tracked file first, then runnpm run import. - If the user explicitly asks you to iterate inside
engine/src/during debugging, export only the file you intentionally changed withnpm run export -- <file>. - After reverting a patch file, also ensure the corresponding
engine/src/file is reverted and the intended patch state is reapplied.
Bare npm run export is dangerous because it can create false patches for branding-managed files and rewrite unrelated patches.
Dao UI code uses the dao:: namespace and mostly lives under src/dao/browser/ui/views/.
DaoSidebarViewis the main vertical sidebar container.DaoTabListView/DaoTabItemViewimplement vertical tabs.DaoAddressBarViewis the sidebar URL pill.DaoCommandBarViewis the Spotlight-style command bar.DaoCornerOverlayViewpaints rounded content corners and shadow.DaoColorscentralizes Dao color tokens.DaoLucideIconscentralizes Lucide icon usage.src/dao/browser/ui/webui/resources/sidebar/hosts the sidebar Lit WebUI.src/dao/browser/ui/webui/resources/agent/hosts the AI Agent Lit WebUI.src/dao/browser/agent/contains agent services, memory, scenarios, skills, and tab lock state.src/dao/browser/pip/contains Picture-in-Picture additions.src/dao/browser/ui/views/split/contains Split View.src/dao/browser/ui/views/little_dao/contains the Little Dao window.src/dao/browser/qrcode/andthird_party/zxing-cpp/support QR generation.
Important Chromium integration patches include:
src/patches/chrome/browser/ui/views/frame/browser_view.cc.patchsrc/patches/chrome/browser/ui/views/frame/browser_view.h.patchsrc/patches/chrome/browser/ui/views/frame/browser_view_layout.cc.patchsrc/patches/chrome/browser/ui/views/frame/browser_frame_mac.mm.patchsrc/patches/chrome/browser/ui/BUILD.gn.patchsrc/patches/chrome/test/BUILD.gn.patch
- Follow Chromium C++ style:
raw_ptr<>,METADATA_HEADER, include guards, existing ownership patterns, and existingbase/viewsconventions. - Keep Dao-owned C++ in the
dao::namespace. - Prefer existing local helpers and design tokens before adding new abstractions.
- Do not hardcode user-facing copy in any language in Dao-owned code.
- Do not use emoji as icons. Use Lucide SVGs for iconography.
- When adding or changing Lucide icons, fetch the current upstream SVG and copy the child nodes verbatim; do not recreate path data from memory.
- Dao WebUI uses Lit / TypeScript.
- Do not use Tailwind utility classes in Dao-owned WebUI files unless they are inside generated/vendor pi-web-ui components.
- For Dao-owned WebUI, use inline styles, scoped CSS files, or Lit
<style>blocks that are actually included in the bundle. - Files under
src/dao/browser/ui/webui/resources/agent/vendor/are generated fromvendor.config.tsandvendor/entries/*; change the entry source and rerunnpm run vendorinstead of editing generated output.
Never hardcode user-facing copy in Dao-owned UI. All user-visible text must have internationalization support, even when the source text is English.
- C++ Views strings go in
src/dao/browser/strings/dao_strings.grdand are read withl10n_util::GetStringUTF16orGetStringFUTF16. - Sidebar WebUI strings go in
src/dao/browser/strings/dao_strings.grd, are registered on the sidebarWebUIDataSourcewithAddLocalizedString/UseStringsJs, and are read from TypeScript throughloadTimeData.getString(...). - Agent WebUI strings go in
src/dao/browser/ui/webui/resources/agent/i18n/locales/en.tsand are read witht('key', { var: 'x' }). zh-CNis hand-authored and treated as the tone reference.- Other locales are generated manually by the user via
OPENAI_API_KEY=... sh ./i18n.sh; do not run it automatically.
- For C++ / Chromium changes, compile confirmation must be
npm run rebuildafter edits are complete. Do not substitute any other command for compilation confirmation. - When running unit tests, run only the smallest necessary subset by default. Do not default to the full test suite; use full coverage only when the change has broad cross-cutting risk or the user explicitly asks for it.
- Choose the smallest relevant verification for the changed surface, such as focused WebUI tests, lint checks, targeted browser test filters, or a narrow manual/browser verification path.
- For browser tests, prefer running only the relevant test binary and
--gtest_filterneeded for the change. Usenpm run testonly when broad Dao coverage is intentionally needed, and treat it as test verification, not compile confirmation. If compilation must be confirmed, runnpm run rebuild. - For WebUI-only changes, run
npm run test:webuiandnpm run lint:litwhen relevant. - Existing browser tests live mainly in
src/dao/browser/ui/views/dao_browser_browsertest.cc. - Dao browser test filters are typically
Dao*,DaoSidebar*, orDaoTabBrowserTest.*.
Do not claim a build or test passed unless you actually ran it and saw it pass.
- Overall feel: calm minimalism, Arc-style vertical tabs, web content as the focal point, blue Dao identity.
- Light sidebar: pale blue-gray
rgb(231, 238, 245)with dark text hierarchy. - Dark sidebar: deep blue-gray
rgb(54, 59, 64)with white text hierarchy. - Accent: blue
rgb(70, 120, 190)for active states. - Shape hierarchy: command bar 16px, URL pill 14px, tabs/buttons 12px, content 10px, favorite icons 8px.
- Interaction: subtle InkDrop ripple, hover highlights, keyboard-first command bar, no global FocusRing.
- Typography: system UI / sans-serif, mostly 12-16px, semibold titles, normal body text.
When creating commits or PRs, use an Angular / Conventional Commits style title/message:
<type>(<scope>): <summary>
Examples:
fix(chat): adjust TTS popup spacing
feat(image): add prompt presets
Rules:
- Use a lowercase type such as
fix,feat,chore,refactor,test,docs,build,ci,perf, orrevert. - Use a concise lowercase scope when it is clear.
- Keep the summary short, imperative, and without a trailing period.
- Do not add a commit body or PR body unless explicitly requested.