Redesign evolve-lite: no hooks, no custom modes — native memory + EVOLVE.md
Redesign evolve-lite: no hooks, no custom modes — native memory + EVOLVE.md
This PR replaces evolve-lite's hook- and custom-mode-driven machinery with a self-directed, native-memory methodology. Recall and save are now the agent's own native behavior; evolve adds only the two things native memory lacks — sharing (mirror into a shared .evolve/ store) and provenance (measure whether recalled guidance actually influenced a session) — delivered as an always-on EVOLVE.md instruction plus a few explicit skills. No background hooks fire; nothing is a no-op.
Per platform:
- Bob — full
EVOLVE.mdas a global rules file (~/.bob/rules/00-evolve-lite.md); custom-mode merge dropped. No native memory, so recall/save are self-directed straight into the shared.evolve/entities/store. - Codex — single always-read pointer in
~/.codex/AGENTS.md→~/.codex/evolve-lite/EVOLVE.md; UserPromptSubmit/SessionStart hooks dropped. Like Bob, self-directs recall/save into.evolve/entities/. - Claude — thin
EVOLVE.mddelivered via a single@.evolve/EVOLVE.mdimport line in the repo'sCLAUDE.md; all auto-firing hooks removed. Native memory owns recall/save; evolve adds mirror-on-save (into the same.evolve/entities/store) + audit-on-recall.
"Memory" and "entity" are the same thing: there is one store, .evolve/entities/<type>/<name>.md (typed dir + a trigger line), that recall, learn, provenance, sync, publish, and subscribe all speak. On Bob/Codex, recall is framed as an explicit first action ("before reading source or running anything, check .evolve/entities/") with the audit folded into it — passive phrasing is reliably skipped by some hosts.
It also closes the provenance loop deterministically (recall → entity → trajectory → recorded verdict) on all three platforms, with native-transcript awareness so it works in the hookless world. Each host's saved transcript is located by its own scheme: Claude ~/.claude/projects/<slug>/<sid>.jsonl, Codex ~/.codex/sessions/.../rollout-<ts>-<sid>.jsonl, and Bob ~/.bob/tmp/<sha256(projectpath)>/chats/session-<ts>-<sid8>.json. Bob exposes no session-id env var, so audit_recall.py recovers the real sessionId from that chat file (gated on BOBSHELL_CLI, inert elsewhere) and provenance matches the trajectory by it.
For human reviewers — get your agent to test this with you
This change is mostly agent-facing plumbing (install scripts, skills, an always-on instruction file, audit/provenance flow). The fastest way to review it is to hand this PR to your coding agent and have it drive the checks while you watch. Suggested prompt to your agent:
"We're reviewing this evolve-lite redesign PR. Check out the branch, then:
- Run the platform-integrations test suite and summarize pass/fail.
- Install evolve-lite for my platform into a throwaway temp project and show me what files it created/changed (especially the always-on instruction and any line injected into my agent config).
- Walk me through the provenance loop end-to-end on a fake
.evolve/so I can see a recall row turn into a recorded influence verdict.- Confirm uninstall cleanly removes everything it added. Explain each step in plain language before you run it, and stop if anything touches a path outside the temp project or my real config."
What you (the human) should personally confirm:
- Blast radius of install. The Claude installer injects one
@.evolve/EVOLVE.mdline into your repo'sCLAUDE.md, and Bob/Codex write an always-on instruction to your global agent config (~/.bob/rules/,~/.codex/AGENTS.md). Make sure you're comfortable with that before running a real (non-dry-run) install. - The one-time Claude import approval. On Claude, the
@importneeds a per-project "allow external imports" approval. If you (or a past session) decline it, the import silently disables and evolve becomes a no-op with no error. The newdoctorskill detects exactly this — run it and confirm it reportsOKafter you approve. - Nothing fires on its own. There are no more recall/save/learn hooks. Recall and save are your agent's native judgment; the evolve steps are explicit. If you expected automatic background behavior, that's intentionally gone.
Quick manual smoke test (safe, no real config touched):
# Test suite (CI-equivalent filter)
uv run pytest tests/platform_integrations/ -q
# Dry-run an install so nothing is written
bash platform-integrations/install.sh install --platform claude --dir /tmp/evolve-demo --dry-run
Testing the live cascade with your agent
Objective: confirm evolve actually captures a memory in a real session and mirrors it into the shared .evolve/ store — then, on a second run, that the recall gets audited. The sandboxed plumbing is covered by the test suite; what you're checking here is the soft, live "loaded ≠ obeyed" layer.
Install for your platform into a throwaway repo, then give your agent a real task with a non-obvious gotcha — an empty repo teaches it nothing, so nothing is worth saving. A reliable shape: a uv-managed project whose tests fail for a non-obvious reason (e.g. a generated-but-uncommitted fixture). Ask it to get the tests passing and to note anything non-obvious for next time, then check that an entity appears under .evolve/entities/.
Pitfalls worth avoiding — otherwise trust the agent:
- Don't name evolve's skills or scripts in your prompt. The always-on
EVOLVE.mdis meant to drive the mirror on its own; naming it invalidates the test. - Nudge the save. Memory saves on the agent's own judgment — a plain "remember this for next time" reliably triggers it; a bare task usually won't.
- On Claude, recall and save are native and evolve only adds mirror + audit + provenance — there's no
recallstep to look for. On Codex/Bob (no native memory) the always-onEVOLVE.mdself-directs recall/save straight into.evolve/entities/— the agent checks the store as a first action and writes a typed entity, rather than you invoking a skill.
For the recall half, run a second session in the same repo that hits the same wall — it should consult the saved entity and log a recall row, which provenance then closes (entity and trajectory resolve on all three platforms). Finish by confirming uninstall reverses everything (it also sweeps legacy pre-redesign installs). The installer auto-allowlists evolve's own scripts, so a real install shouldn't prompt on the mirror/audit steps.
For agents working on this PR
Read this section before editing anything.
Source of truth: edit plugin-source/, never the rendered tree
platform-integrations/{claude,claw-code,codex,bob}/... is generated output. Do not hand-edit it — your change will be overwritten and the drift gate will fail. Edit the templates/scripts under plugin-source/, then regenerate:
uv run python plugin-source/build_plugins.py render # rewrite platform-integrations/
uv run python plugin-source/build_plugins.py check # MUST exit 0 (no drift)
*.j2files render through Jinja2 per platform ({{ platform }}+ macros inplugin-source/_macros.j2).- Non-
.j2scripts (e.g.provenance.py,log_influence.py,adapt_memory.py,doctor.py) are copied verbatim to all four platforms, so one edit fans out to all of them. - The shared lib lives at
plugin-source/lib/and renders intolib/evolve-lite/on every host. Scripts resolve it by walking up tolib/evolve-lite/entity_io.py; that resolution only works in the rendered tree, so integration tests run the rendered Claude copy. - Three EVOLVE.md variants exist (Claude is thin/native; Bob+Codex are the full self-directed methodology). When touching skill scripts, remember the bob path is structurally different (
.bob/skills/evolve-lite-<name>/, colon-free on disk).
Required gate before any commit
The pre-commit gate runs more than pytest. All of these must pass:
uv run ruff check .
uv run ruff format --check .
uv run mypy .
uv run python plugin-source/build_plugins.py check # render drift
uv run pytest tests/platform_integrations/ -q # default CI filter
Notes:
mypyexcludesplugin-source/andplatform-integrations/, but nottests/— typed test code is checked.- Any module-level import after a
sys.path.insertneeds# noqa: E402. - After a
sys.pathshim, scripts import the shared lib (entity_io,audit) by bare name; keep that pattern.
Test layout
- Tests live in
tests/platform_integrations/and are markedplatform_integrations(+ sometimese2e/llm). - CI runs the default filter
-m 'not llm and not e2e'(~270 of ~430 collected). Sandboxed, fast tests (doctor, provenance, the end-to-end chain, the per-platform trajectory locators) deliberately ship without thee2emarker so they run as guards in the default suite. Don't re-adde2eto a fast sandboxed test. conftest.pysandboxesHOMEfor every test (so installs never touch real~/.bob,~/.codex,~/.claude). Reusetemp_project_dir,sandbox_home, and the*_audit_script/*_evolve_mdfixtures rather than building paths by hand.- The native-transcript locator builds
~/.claude/projects/<slug>/<sid>.jsonlwhere<slug>slugifies the resolved project root (every non-alphanumeric →-). The same slug logic lives indoctor.py; keep the two in sync.
Provenance: keep the verdict agent-driven
provenance.py does only deterministic work — read recall rows, skip already-influenced pairs, resolve <type>/<name> entity files, locate the trajectory, emit JSONL candidates (gaps surfaced via a missing:[...] field, never dropped), and persist a verdict via the existing log_influence writer. The semantic verdict (followed/contradicted/not_applicable) is an LLM judgment and must stay agent-driven. Do not invent a heuristic verdict. If you can't separate the judgment from the plumbing, stop and flag it rather than faking it.
🤖 Generated with Claude Code
Summary by CodeRabbit
-
New Features
- Mirror native memories into a shared, auditable evolve store (idempotent, deterministic writes)
- Record which memories were consulted via a recall-audit CLI (prints session token when minted)
- Generate provenance candidates and record single-verdict provenance entries
- Add a diagnostic "doctor" command to verify evolve import delivery
-
Documentation
- New/rewritten guides for adapt-memory, provenance, and doctor workflows
-
Chores
- Installer now deploys per-platform evolve files, managed pointer lines, and global audit scripts
[!NOTE]
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
- [ ] ▶️ Resume reviews
- [ ] 🔍 Trigger review
📝 Walkthrough
Walkthrough
Adds per-platform EVOLVE docs and audit scripts, deterministic entity IO and adapt/doctor/provenance CLIs, installer managed-pointer/global-script delivery, and wide test updates including end-to-end provenance validation.
Changes
Evolve-lite memory, audit, and provenance workflow
| Layer / File(s) | Summary |
|---|---|
Rendered EVOLVE docs and audit CLIs platform-integrations/*/EVOLVE.md, plugin-source/EVOLVE.md.j2, platform-integrations/*/lib/evolve-lite/audit_recall.py, plugin-source/lib/audit_recall.py |
Adds per-platform EVOLVE docs and a portable audit_recall.py CLI to record recall events into .evolve/audit.log; build context exposes audit_script to templates. |
Entity IO and adapt-memory/doctor platform-integrations/*/lib/evolve-lite/entity_io.py, platform-integrations/*/skills/evolve-lite/adapt-memory/..., platform-integrations/*/skills/evolve-lite/doctor/..., plugin-source/lib/entity_io.py |
Introduces sanitize_type, preserves native_path in frontmatter, and extends write_entity_file(directory, entity, filename=None, overwrite=False) with deterministic overwrite=True behavior; adds adapt_memory.py to mirror native memories and doctor.py to validate Claude import delivery. |
Provenance candidate and record flow platform-integrations/*/skills/evolve-lite/provenance/*, plugin-source/skills/evolve-lite/provenance/* |
Adds provenance.py with candidates (emit JSONL candidates per unresolved (session,entity)) and record (validate and append deduplicated influence rows); trajectory resolution checks .evolve/trajectories/ then native Claude transcripts. |
Installer and managed-pointer delivery platform-integrations/install.sh, plugin-source/build_plugins.py |
Installer gains marker/sentinel helpers and shifts Bob/Claude/Codex to managed-pointer delivery: writes per-platform EVOLVE copies or global EVOLVE files, injects/removes managed pointer lines, installs global audit-recall scripts, and removes old Codex hook-group wiring. |
Tests: fixtures, integration, and e2e tests/platform_integrations/* |
Adds sandboxed HOME fixture, unit tests for marker-line ops, audit_recall tests, entity_io/adapt e2e tests, provenance candidates/record integration tests, and updates installer/idempotency/preservation tests to the new managed-delivery contract. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant AdaptScript
participant EntityStore
participant AuditScript
participant Provenance
participant TranscriptStore
User->>AdaptScript: mirror native memory (file path, --type, --trigger)
AdaptScript->>EntityStore: write entity (type/slug + native_path)
User->>AuditScript: record consulted entity ids
Provenance->>AuditScript: read recall events
Provenance->>TranscriptStore: locate transcript for session_id
Provenance->>EntityStore: read entity excerpt
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related issues
- AgentToolkit/altk-evolve#219: The PR implements the unified plugin-source + build pipeline and cross-platform render changes referenced by this issue.
Possibly related PRs
- AgentToolkit/altk-evolve#251: Overlaps provenance candidate/record workflow and influence audit handling.
- AgentToolkit/altk-evolve#213: Touches Claude hooks area; this PR removes/rewrites hooks and both affect same subsystem.
- AgentToolkit/altk-evolve#196: Related entity_io and Codex installer wiring changes intersect with this work.
Suggested reviewers
- visahak
- vinodmut
Poem
"I’m a rabbit with a tiny pad,
I hop through memories, not so bad. 🐇
I stamp a log and mirror a thought,
Then provenance finds what time has taught.
Hooray for audits neatly had!"
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Commit unit tests in branch
redesign/evolve-lite-no-hooks-modes
No vulnerabilities found.
Re: CodeRabbit's Critical — Claude-only doctor skill copied into the Codex (and Bob) plugins (commit 5196fff)
Agreed the diagnostic is Claude-specific: it greps ~/.claude/projects/<slug>/*.jsonl transcripts for the @import canary and checks .claude/CLAUDE.md paths — none of which exist where there's no @import (Codex uses an ~/.codex/AGENTS.md pointer instead). Rather than ship a stub Codex health check with no real signal, we exclude doctor from the codex and bob plugins at build time:
- Added
target_excludes = [r"^skills/evolve-lite/doctor/"]to the codex and bob entries inplugin-source/build_plugins.pyPLATFORMS(matched against the source-side path, pre-rewrite, so it also covers bob's flattenedskills/evolve-lite-doctor/). - Fixed
_bob_command_targets()to honortarget_excludes— it previously walked_discover_skills()unconditionally and would still emitcommands/evolve-lite-doctor.mdfor bob (drift). - Updated
test_build_pipeline.py::TestBobCommandGenerationto derive the expected command set from_bob_command_targets()and assertdoctoris excluded.
doctor is kept for claude and claw-code (claw-code is a claude-code fork reusing the same @import/.claude-plugin mechanics). Full gate green (ruff/format/mypy/drift-check + 252 tests).