Skip to content

refactor(evolve-lite): replace EVOLVE_ENTITIES_DIR with EVOLVE_DIR#148

Merged
visahak merged 6 commits intoAgentToolkit:mainfrom
vinodmut:evolvedir
Apr 4, 2026
Merged

refactor(evolve-lite): replace EVOLVE_ENTITIES_DIR with EVOLVE_DIR#148
visahak merged 6 commits intoAgentToolkit:mainfrom
vinodmut:evolvedir

Conversation

@vinodmut
Copy link
Copy Markdown
Contributor

@vinodmut vinodmut commented Apr 3, 2026

Introduce EVOLVE_DIR as the root for all evolve data (entities, trajectories, config, etc.) instead of pointing directly at the entities subdirectory. Adds get_evolve_dir() helper as the single resolution point for the env var vs cwd fallback.

Summary by CodeRabbit

  • Documentation

    • Updated guidance to use EVOLVE_DIR to override the entire .evolve data directory and removed older variable references.
  • Refactor

    • Directory discovery now consistently derives entity locations from the single EVOLVE_DIR base.
  • Installer

    • Installation hook now sets and respects EVOLVE_DIR for persistent plugin data.
  • Tests

    • New tests cover discovery, creation, and idempotent behavior with and without EVOLVE_DIR.

Introduce EVOLVE_DIR as the root for all evolve data (entities,
trajectories, config, etc.) instead of pointing directly at the
entities subdirectory. Adds get_evolve_dir() helper as the single
resolution point for the env var vs cwd fallback.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1a8d9f96-c471-4656-9665-0dc556c4dbe7

📥 Commits

Reviewing files that changed from the base of the PR and between 7ac2249 and 76173b6.

📒 Files selected for processing (1)
  • tests/platform_integrations/test_codex.py

📝 Walkthrough

Walkthrough

Replaces per-entity env var with a single EVOLVE_DIR pointing at the .evolve root; adds get_evolve_dir(), simplifies entity discovery to {EVOLVE_DIR}/entities (or ./.evolve/entities by default), updates installer export, and adds pytest coverage for the new resolution behavior.

Changes

Cohort / File(s) Summary
Documentation
platform-integrations/claude/plugins/evolve-lite/README.md
Replaced EVOLVE_ENTITIES_DIR with EVOLVE_DIR in env var docs and removed CLAUDE_PROJECT_ROOT from the Environment Variables section.
Directory resolution logic
platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py
Added get_evolve_dir(); find_entities_dir() now only checks {get_evolve_dir()}/entities and returns it if present; get_default_entities_dir() always creates and returns {get_evolve_dir()}/entities. Removed prior multi-candidate/fallback discovery.
Installer script
platform-integrations/install.sh
Changed _codex_recall_hook_command() to export EVOLVE_DIR="$d/.evolve" (was EVOLVE_ENTITIES_DIR="$d/.evolve/entities").
Tests
tests/platform_integrations/test_entity_io.py, tests/platform_integrations/test_codex.py
Added tests covering get_evolve_dir(), find_entities_dir(), and get_default_entities_dir() behaviors with and without EVOLVE_DIR; updated expected installer command in Codex test to match EVOLVE_DIR export.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • visahak
  • illeatmyhat

Poem

🐰 I hop through folders, soft and spry,

One EVOLVE_DIR beneath the sky,
Entities, configs snug in one den—
A tidy burrow for me and my pen. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly summarizes the main change: replacing EVOLVE_ENTITIES_DIR with EVOLVE_DIR across the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py (1)

68-79: Docstring mentions "search order" but there's now only one candidate.

The docstring describes a two-step "search order" (env var vs cwd), but the implementation delegates to get_evolve_dir() which handles both cases. The numbered list implies two distinct checks when really there's just one path computed differently based on env var presence.

📝 Suggested docstring simplification
 def find_entities_dir():
     """Locate the entities directory.
 
-    Search order:
-      1. ``{EVOLVE_DIR}/entities/`` (from env var)
-      2. ``.evolve/entities/`` (cwd)
+    Returns ``{get_evolve_dir()}/entities/`` if the directory exists.
+    See :func:`get_evolve_dir` for path resolution details.
 
     Returns:
         Path to the directory if it exists, else ``None``.
     """
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py` around
lines 68 - 79, The docstring for find_entities_dir is misleading: it lists a
two-step "search order" but the function only computes a single path via
get_evolve_dir() and returns it if it exists. Update the docstring of
find_entities_dir to remove the numbered search list and instead clearly state
that it uses get_evolve_dir() to determine the base directory and returns the
"entities" subdirectory Path if it exists or None otherwise; reference
get_evolve_dir in the text so readers know where the actual lookup logic lives.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py`:
- Around line 68-79: The docstring for find_entities_dir is misleading: it lists
a two-step "search order" but the function only computes a single path via
get_evolve_dir() and returns it if it exists. Update the docstring of
find_entities_dir to remove the numbered search list and instead clearly state
that it uses get_evolve_dir() to determine the base directory and returns the
"entities" subdirectory Path if it exists or None otherwise; reference
get_evolve_dir in the text so readers know where the actual lookup logic lives.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58991294-b8de-4df0-8ba7-eb1a09fe3451

📥 Commits

Reviewing files that changed from the base of the PR and between 06f8461 and 93df58a.

📒 Files selected for processing (3)
  • platform-integrations/claude/plugins/evolve-lite/README.md
  • platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py
  • platform-integrations/install.sh

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/platform_integrations/test_entity_io.py (1)

8-9: Consider a cleaner import approach.

Manipulating sys.path at module level before importing can be fragile and affects other tests if run in the same process. A conftest.py fixture or using importlib with explicit path would be more maintainable.

♻️ Alternative using importlib
import importlib.util
from pathlib import Path

_lib_path = Path(__file__).parent.parent.parent / "platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py"
_spec = importlib.util.spec_from_file_location("entity_io", _lib_path)
entity_io = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(entity_io)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/platform_integrations/test_entity_io.py` around lines 8 - 9, The test
currently mutates sys.path at module import time (sys.path.insert(...) then
import entity_io) which is fragile; instead load entity_io without altering
global import state by either providing a fixture in conftest.py that imports
the module from its file location and yields it to tests, or use
importlib.util.spec_from_file_location to load "entity_io" from the repo path
inside the test setup/fixture; update tests in
tests/platform_integrations/test_entity_io.py to remove the sys.path
modification and reference the provided fixture or the imported module object
(entity_io) so other tests aren’t affected.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/platform_integrations/test_entity_io.py`:
- Around line 1-9: Add the pytest marker for platform integrations by defining a
module-level pytestmark variable in this test module: import pytest if not
already present and add pytestmark = pytest.mark.platform_integrations near the
top of tests/platform_integrations/test_entity_io.py so all tests in the file
are marked (alternatively decorate individual test functions with
`@pytest.mark.platform_integrations` if you prefer function-level marking); ensure
the symbol pytestmark is used and pytest is imported.

---

Nitpick comments:
In `@tests/platform_integrations/test_entity_io.py`:
- Around line 8-9: The test currently mutates sys.path at module import time
(sys.path.insert(...) then import entity_io) which is fragile; instead load
entity_io without altering global import state by either providing a fixture in
conftest.py that imports the module from its file location and yields it to
tests, or use importlib.util.spec_from_file_location to load "entity_io" from
the repo path inside the test setup/fixture; update tests in
tests/platform_integrations/test_entity_io.py to remove the sys.path
modification and reference the provided fixture or the imported module object
(entity_io) so other tests aren’t affected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0372d1fc-304d-4c4d-b9ae-09f3a3ad9eb6

📥 Commits

Reviewing files that changed from the base of the PR and between 93df58a and 019e7c3.

📒 Files selected for processing (2)
  • platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py
  • tests/platform_integrations/test_entity_io.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py

vinodmut added 2 commits April 3, 2026 23:24
Addresses CodeRabbit review finding: Add @pytest.mark.platform_integrations marker to all test functions
vinodmut added 2 commits April 4, 2026 00:04
Keep EVOLVE_DIR-based implementation from evolvedir branch, which supersedes
the EVOLVE_ENTITIES_DIR approach removed in public/main (AgentToolkit#147).
@visahak visahak merged commit 1412f57 into AgentToolkit:main Apr 4, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants