Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions emrg/server/evolution_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

---
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -527,7 +530,17 @@ gh pr create -R {{ owner }}/{{ repo }} --title "emrg: <short-description>" --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.

---

Expand Down
6 changes: 5 additions & 1 deletion emrg/server/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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-<ts>.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:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading