From 55b904632d8f23a01f7f21a02985dbbbe75bdc50 Mon Sep 17 00:00:00 2001 From: EMRG Evolution Date: Wed, 12 Aug 2026 18:06:41 +0800 Subject: [PATCH] emrg: unify evolution cycle records into memory system (rant 2026-08-12T18:03:26) --- emrg/server/evolution_prompt.md | 21 +++++++++++++++++---- emrg/server/scheduler.py | 6 +++++- tests/test_scheduler.py | 2 ++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/emrg/server/evolution_prompt.md b/emrg/server/evolution_prompt.md index c496a72..15039c0 100644 --- a/emrg/server/evolution_prompt.md +++ b/emrg/server/evolution_prompt.md @@ -17,14 +17,14 @@ You are EMRG's self-evolution module. **Every cycle you MUST fully execute the " ### ๐ŸŒ Language Policy (global, applies to every cycle) -> **Language policy**: All outward-facing GitHub outputs โ€” **PR titles, PR bodies, review comments, issue replies, and community participation** โ€” MUST be written in **English**, regardless of the language of the triggering rant. Keep rant content verbatim when quoting it. **Internal artifacts** (evolution-cycle logs, MEMORY.md, session notes) are **exempt** and may stay in the author's language. +> **Language policy**: All outward-facing GitHub outputs โ€” **PR titles, PR bodies, review comments, issue replies, and community participation** โ€” MUST be written in **English**, regardless of the language of the triggering rant. Keep rant content verbatim when quoting it. **Internal artifacts** (cycle memory entries, MEMORY.md, session notes) are **exempt** and may stay in the author's language. Specifically: 1. **PR title, PR body**: always English (even when the rant is Chinese) 2. **PR review comments** (LGTM / needs fix / technical feedback): always English 3. **Commit message**: English (`emrg:` prefix convention, keep it) 4. **Issue replies and community output**: English -5. **Internal records** (evolution-cycle-*.md, MEMORY.md): unrestricted (local-only, may stay Chinese) +5. **Internal records** (cycle memory entries under `memory/`, MEMORY.md, session notes): unrestricted (local-only, may stay Chinese) 6. **Quoting rants**: keep the rant verbatim (Chinese stays Chinese), but describe it in English in outward-facing output --- @@ -232,7 +232,10 @@ The Contributor's role is **contributing code and knowledge**, not gatekeeping. #### 2.1 Own records -Read the last 3-5 `evolution-cycle-*.md` files under `{{ evolution_cwd }}/.emrg/memory/` and analyze: +Read the last 3-5 cycle records and analyze: + +- **New format** (rant 2026-08-12T18:03:26): memory entries under `{{ evolution_cwd }}/.emrg/memory/` whose frontmatter has `type: task` + `scope: project` and an id starting with `cyc` (e.g. `cyc20260812-...`); they are indexed in `MEMORY.md` +- **Legacy format** (keep for compatibility): `evolution-cycle-*.md` files under `{{ evolution_cwd }}/.emrg/memory/` โ€” old records remain readable during the transition; do not create new ones - **Repeated patterns**: making the same kind of trivial per-file changes? โ†’ batch them. Repeatedly fixing the same feature? โ†’ refactor - **Effectiveness**: did the last change have lasting effect? Consecutive "nothing to evolve" while rants are non-empty โ†’ re-check @@ -527,7 +530,17 @@ gh pr create -R {{ owner }}/{{ repo }} --title "emrg: " --bod ### 6. Record -Create `evolution-cycle-{{ timestamp }}.md` recording findings, changes, and expected effects; update `MEMORY.md`. +Create a **cycle memory entry** (rant 2026-08-12T18:03:26 โ€” no more standalone `evolution-cycle-*.md` files; the record lives in the memory system): + +- Write `{{ evolution_cwd }}/.emrg/memory/cycle-{{ timestamp }}.md` with YAML frontmatter: + - `id`: `cyc{{ timestamp }}` (e.g. `cyc20260812-180325`) + - `event_at` / `created_at` / `updated_at`: ISO timestamps + - `type: task`, `scope: project`, `status: active` (cycle in progress) or `completed` (final) +- Body: findings, changes, verification results, expected effects (same content as before, just a memory file) +- Update the `MEMORY.md` index in the same directory (add one row, id linked to the filename) โ€” this is the **single index** for cycle records +- Keep the file format identical to other memory entries (frontmatter + Markdown body) + +> Transition note: legacy `evolution-cycle-*.md` files remain in place (readable, never deleted); only new records use the memory entry path. --- diff --git a/emrg/server/scheduler.py b/emrg/server/scheduler.py index efc198a..ec32a25 100644 --- a/emrg/server/scheduler.py +++ b/emrg/server/scheduler.py @@ -871,8 +871,12 @@ async def _run_evolution_cycle(self) -> None: return cycle_ts = cycle_time.isoformat() + # Rant 2026-08-12T18:03:26: cycle records are now memory entries + # (memory/cycle-.md, written by the agent per evolution_prompt ยง6), + # not standalone evolution-cycle-*.md files โ€” keep the impact tag + # aligned with the new naming. impact = [ - f"evolution-cycle-{cycle_ts}-{'truncated' if truncated else 'complete'}", + f"cycle-{cycle_ts}-{'truncated' if truncated else 'complete'}", f"tools-executed={tool_count}", ] if truncated: diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index 49ed476..8441ee4 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -1111,6 +1111,8 @@ def test_evolution_cycle_complete_unchanged_head_still_empty(tmp_path): "unchanged-HEAD complete cycle is still counted as empty (existing behavior)" impact = captured["log"].impact assert any(i.endswith("-complete") for i in impact), impact + assert any(i.startswith("cycle-") for i in impact), \ + f"impact tag uses new cycle- prefix (rant 2026-08-12T18:03:26), got {impact}" assert "truncated=max-tool-rounds" not in impact, impact