fix(cli): agents init creates project-local .cleveragents/ instead of spec-required global ~/.cleveragents/ #3906

Open
opened 2026-04-06 07:20:11 +00:00 by hurui200320 · 1 comment
Member

Metadata

  • Commit Message: fix(cli): agents init creates project-local .cleveragents/ instead of spec-required global ~/.cleveragents/
  • Branch: fix/init-global-vs-local

Background

The specification (line 1228) defines agents init as: "Initialize or reset the global CleverAgents environment." The expected behavior is that it creates and configures ~/.cleveragents/ as the global data directory. However, the current implementation behaves as a project-local init, creating .cleveragents/ in the current working directory.

Current Behavior

  1. Running agents init --yes in /tmp/test-project creates /tmp/test-project/.cleveragents/ (project-local)
  2. After init, agents diagnostics still reports:
    • Data directory: WARN missing (/home/user/.cleveragents)
    • Database: ERROR parent dir not writable (/home/user/.cleveragents)
  3. The global data directory ~/.cleveragents/ is never initialized by any command
  4. The diagnostics command checks the global path but init creates a local path — these two commands are fundamentally inconsistent

Expected Behavior

Per the specification:

  • agents init should initialize the global CleverAgents environment at ~/.cleveragents/
  • After running agents init --yes, agents diagnostics should show all-green for data directory and database checks
  • Project-local initialization (if desired) should be a separate operation or require explicit flags
  • #3645 (Settings.data_dir default is relative Path("data") instead of spec-required ~/.cleveragents — this is the root cause)
  • #3660 (diagnostics config file check defaults to relative path)
  • #3747 (CLI missing --data-dir and --config-path global options)

Subtasks

  • Determine whether agents init should be global-only, project-local-only, or support both via flags
  • Fix Settings.data_dir default to resolve to ~/.cleveragents/ per spec (may overlap with #3645)
  • Update init_command() to create the global data directory structure
  • Ensure agents diagnostics passes cleanly after agents init --yes
  • Tests (Behave): Add scenario verifying init + diagnostics consistency
  • Tests (Robot): Add integration test for global init path
  • Verify coverage >=97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
## Metadata - **Commit Message**: `fix(cli): agents init creates project-local .cleveragents/ instead of spec-required global ~/.cleveragents/` - **Branch**: `fix/init-global-vs-local` ## Background The specification (line 1228) defines `agents init` as: "Initialize or reset the **global** CleverAgents environment." The expected behavior is that it creates and configures `~/.cleveragents/` as the global data directory. However, the current implementation behaves as a project-local init, creating `.cleveragents/` in the current working directory. ## Current Behavior 1. Running `agents init --yes` in `/tmp/test-project` creates `/tmp/test-project/.cleveragents/` (project-local) 2. After init, `agents diagnostics` still reports: - `Data directory: WARN missing (/home/user/.cleveragents)` - `Database: ERROR parent dir not writable (/home/user/.cleveragents)` 3. The global data directory `~/.cleveragents/` is never initialized by any command 4. The diagnostics command checks the global path but init creates a local path — these two commands are fundamentally inconsistent ## Expected Behavior Per the specification: - `agents init` should initialize the **global** CleverAgents environment at `~/.cleveragents/` - After running `agents init --yes`, `agents diagnostics` should show all-green for data directory and database checks - Project-local initialization (if desired) should be a separate operation or require explicit flags ## Related Issues - #3645 (Settings.data_dir default is relative Path("data") instead of spec-required ~/.cleveragents — this is the root cause) - #3660 (diagnostics config file check defaults to relative path) - #3747 (CLI missing --data-dir and --config-path global options) ## Subtasks - [ ] Determine whether `agents init` should be global-only, project-local-only, or support both via flags - [ ] Fix `Settings.data_dir` default to resolve to `~/.cleveragents/` per spec (may overlap with #3645) - [ ] Update `init_command()` to create the global data directory structure - [ ] Ensure `agents diagnostics` passes cleanly after `agents init --yes` - [ ] Tests (Behave): Add scenario verifying init + diagnostics consistency - [ ] Tests (Robot): Add integration test for global init path - [ ] Verify coverage >=97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done.
Owner

Thank you for filing this issue, @hurui200320. This is a well-documented bug with clear spec references and related issue links.

Triage assessment:

This issue is well-formed and clearly actionable. It has already been verified and triaged by the project owner with appropriate labels (State/Verified, Priority/Medium, Points/3, MoSCoW/Should Have, Type/Bug).

Additional context from the liaison:

  • This issue correctly identifies the root cause as #3645 (Settings.data_dir default). Fixing this issue will likely require coordinating with #3645, #3660, and #3747 to avoid conflicting changes.
  • The spec reference (line 1228) is accurate — agents init is defined as a global environment initialization command.
  • The init + diagnostics inconsistency is a significant UX problem that affects first-time users.
  • Parent Epic: This should be linked to Epic #362 (Plan Lifecycle & CLI) or a more appropriate CLI-focused epic. The issue currently has no parent epic assigned.

Recommendation: This issue is ready for implementation. The dependency chain is: #3645 (root cause) → #3906 (this issue) → #3660 and #3747 (related fixes). Ideally #3645 should be resolved first or simultaneously.


Automated by CleverAgents Bot
Supervisor: Human Liaison | Agent: ca-human-liaison

Thank you for filing this issue, @hurui200320. This is a well-documented bug with clear spec references and related issue links. **Triage assessment:** This issue is well-formed and clearly actionable. It has already been verified and triaged by the project owner with appropriate labels (`State/Verified`, `Priority/Medium`, `Points/3`, `MoSCoW/Should Have`, `Type/Bug`). **Additional context from the liaison:** - This issue correctly identifies the root cause as #3645 (`Settings.data_dir` default). Fixing this issue will likely require coordinating with #3645, #3660, and #3747 to avoid conflicting changes. - The spec reference (line 1228) is accurate — `agents init` is defined as a global environment initialization command. - The `init` + `diagnostics` inconsistency is a significant UX problem that affects first-time users. - **Parent Epic**: This should be linked to Epic #362 (Plan Lifecycle & CLI) or a more appropriate CLI-focused epic. The issue currently has no parent epic assigned. **Recommendation**: This issue is ready for implementation. The dependency chain is: #3645 (root cause) → #3906 (this issue) → #3660 and #3747 (related fixes). Ideally #3645 should be resolved first or simultaneously. --- **Automated by CleverAgents Bot** Supervisor: Human Liaison | Agent: ca-human-liaison
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#3906
No description provided.