#3207: fix: use .moltbot for device identity directory
Fixes #3198
## Summary
Change default device identity directory from `.clawdbot` to `.moltbot`.
## The Problem
`src/infra/device-identity.ts` hardcodes `.clawdbot/identity` which causes the old directory to be recreated even
for users who migrated to `.moltbot`.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the default device identity storage directory in `src/infra/device-identity.ts` from `~/.clawdbot/identity` to `~/.moltbot/identity`, preventing the legacy `.clawdbot` identity directory from being re-created after users have migrated.
The change is localized to the default path constant used by `loadOrCreateDeviceIdentity()`, which is consumed by gateway/client initialization and related tests/helpers when no explicit identity path is provided.
<h3>Confidence Score: 4/5</h3>
- This PR is low risk and likely safe to merge, with a small behavioral edge case around state-dir overrides.
- The change is a single constant update affecting where a file is read/written by default. The main concern is consistency with the repo’s broader state directory resolution (env overrides and legacy/new preference), which could lead to surprising identity location for users who rely on `MOLTBOT_STATE_DIR`/`CLAWDBOT_STATE_DIR` or migration behavior.
- src/infra/device-identity.ts
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#3783: Fix/3038 cli name moltbot
by Shuimo03 · 2026-01-29
83.0%
#17916: [ fix ] : correct config directory path during onboarding
by Dijo-404 · 2026-02-16
80.0%
#3561: fix: fail fast when both state dirs exist
by adityarao3 · 2026-01-28
79.2%
#5638: fix: rewrite sessionFile paths during state dir migration
by lailoo · 2026-01-31
77.0%
#3513: fix(docker): add MOLTBOT_STATE_DIR to resolve permission error
by Suksham-sharma · 2026-01-28
76.7%
#4695: Fixed the default CLI image to use published GHCR image
by TASMAYU · 2026-01-30
76.3%
#8203: fix clawdbot references
by anton-roos · 2026-02-03
76.1%
#4070: fix(docker): expose moltbot CLI in Docker image
by saianilsingi · 2026-01-29
75.3%
#4467: fix: DEFAULT_SANDBOX_WORKSPACE_ROOT respects STATE_DIR
by Aphroq · 2026-01-30
75.0%
#3965: Fix Docker Compose configuration for moltbot deployment
by YoByron · 2026-01-29
74.8%