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
2 changes: 1 addition & 1 deletion README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ TUI 内:`Esc` 中断流式输出,`Ctrl+C` / `exit` 退出(配置与 GUI
| | Claude Code | Codex | DeepSeek Harness | **EMRG** | **Grok Bot** |
|---|---|---|---|---|---|
| AI 驱动编程 | ✅ | ✅ | ✅ | ✅ | ✅ |
| 工具调用 (`bash`/`pwsh`、`read`、`write`、`edit`、`glob`、`grep`、`submit_rant`、`subagent`、`boss`) | ✅ | ✅ | ✅ | ✅ | ✅ |
| 工具调用 (`bash`/`pwsh`、`read`、`write`、`edit`、`glob`、`grep`、`submit_rant`、`subagent`) | ✅ | ✅ | ✅ | ✅ | ✅ |
| 会话记忆与上下文 | ✅ | ✅ | ✅ | ✅ | ✅ |
| `/` 命令自动补全 | ✅ | ✅ | ✅ | ✅ | ~ *@ mention 建议 + 命令面板* |
| ESC 中断 | ✅ | ✅ | — | ✅ | ✅ |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ In the TUI: `Esc` interrupts streaming, `Ctrl+C` / `exit` quits (config is share
| | Claude Code | Codex | DeepSeek Harness | **EMRG** | **Grok Bot** |
|---|---|---|---|---|---|
| AI-powered coding | ✅ | ✅ | ✅ | ✅ | ✅ |
| Tool-calling (`bash`/`pwsh`, `read`, `write`, `edit`, `glob`, `grep`, `submit_rant`, `subagent`, `boss`) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Tool-calling (`bash`/`pwsh`, `read`, `write`, `edit`, `glob`, `grep`, `submit_rant`, `subagent`) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Session memory & context | ✅ | ✅ | ✅ | ✅ | ✅ |
| `/` command autocomplete | ✅ | ✅ | ✅ | ✅ | ~ *@ mention + command palette* |
| ESC interrupt | ✅ | ✅ | — | ✅ | ✅ |
Expand Down
6 changes: 3 additions & 3 deletions emrg/server/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
under ``~/.emrg/sessions/``, beside the runtime configuration. That mixes "where this
installation keeps its files" into "a directory someone works in", and the register
is the second thing only;
* **any directory under an existing Agent's ``.emrg/``** — the sub-session slot, the
boss session, every directory the server derives. Those are that Agent's own
* **any directory under an existing Agent's ``.emrg/``** — the sub-session slot, and
every other directory the server derives. Those are that Agent's own
bookkeeping, reached through its path; they are not directories a host opened, and a
row for one would claim the bookkeeping is a workspace. The test is the path alone,
so it needs no name, no flag and no knowledge of who created the session.
Expand Down Expand Up @@ -219,7 +219,7 @@ def for_dir(self, cwd: str | os.PathLike[str]) -> dict:
return row

# A directory under an existing Agent's `.emrg/` is that Agent's bookkeeping
# (the sub-session slot, the boss session), not a directory a host opened.
# (the sub-session slot), not a directory a host opened.
for row in rows:
inner = os.path.join(row.get("path") or "", ".emrg")
if base == inner or base.startswith(inner + os.sep):
Expand Down
2 changes: 0 additions & 2 deletions emrg/server/competition_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ These instructions amend this task for one installation; they are not a second t

**Do not skip. Execute even if "everything looks fine".**

**The round's first step is to call `boss`** — a separate session that owns this task's direction while this one does the work — and to treat its answer as the round's stance; whatever the answer does not mention is still this session's to decide. A session that is not offered `boss` has no owner to ask, and carries on without one.

#### 0.1 Environment verification

- **Browser first**: `browser-harness` (`BU_CDP_URL=http://127.0.0.1:57000`) reuses the host's already-logged-in browser. Competition platforms (Tianchi, Kaggle, DataFountain, HuggingFace) require login for rules pages, data download and submission — **the login state exists only in the real browser**.
Expand Down
323 changes: 16 additions & 307 deletions emrg/server/daemon.py

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions emrg/server/evolution_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ You are EMRG's self-evolution module. **Every cycle executes the whole loop —

Get able to work: gh installed, role known, source synced.

**The round's first step is to call `boss`** — a separate session that owns this task's direction while this one does the work — and to treat its answer as the round's stance; whatever the answer does not mention is still this session's to decide. A session that is not offered `boss` has no owner to ask, and carries on without one.

#### 0.1 GitHub CLI

**Install gh CLI** (required for GitHub operations; install if missing):
Expand Down
2 changes: 0 additions & 2 deletions emrg/server/feishu_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ overrides it — and by nothing else. The cadence is not this round's to lower.

### 1. Read

**The round's first step is to call `boss`** — a separate session that owns this task's direction while this one does the work — and to treat its answer as the round's stance; whatever the answer does not mention is still this session's to decide. A session that is not offered `boss` has no owner to ask, and carries on without one.

Messages come from `lark-cli`, which speaks the Feishu IM API. If it is not on `PATH`, look
in the usual install locations before calling it blocked.

Expand Down
2 changes: 0 additions & 2 deletions emrg/server/ios_app_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ These instructions amend this task for one installation; they are not a second t

**Do not skip it, including the rounds where "everything looks fine".**

**The round's first step is to call `boss`** — a separate session that owns this task's direction while this one does the work — and to treat its answer as the round's stance; whatever the answer does not mention is still this session's to decide. A session that is not offered `boss` has no owner to ask, and carries on without one.

#### 0.1 Instance values come from `extra_prompt`, never from this file

This template ships identically to every EMRG instance, so it carries **no instance-specific value at all**. Everything about *your* account is read from the task's `extra_prompt`, which the host writes into `tasks.yml`: the Apple developer team id, the App Store Connect API key's path and issuer id, which bundle-id prefix to use, the account an app's repository is created under and the directory that holds it, the budget, and any preference about which category to prefer or avoid.
Expand Down
2 changes: 0 additions & 2 deletions emrg/server/journal_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ These instructions amend this task for one installation; they are not a second t

**Do not skip. Execute even if "everything looks fine".**

**The round's first step is to call `boss`** — a separate session that owns this task's direction while this one does the work — and to treat its answer as the round's stance; whatever the answer does not mention is still this session's to decide. A session that is not offered `boss` has no owner to ask, and carries on without one.

#### 0.1 Environment verification

```bash
Expand Down
2 changes: 0 additions & 2 deletions emrg/server/open_source_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ These instructions amend this task for one installation; they are not a second t

Get able to work: `gh` authenticated, the role known and locked, the source synced.

**The round's first step is to call `boss`** — a separate session that owns this task's direction while this one does the work — and to treat its answer as the round's stance; whatever the answer does not mention is still this session's to decide. A session that is not offered `boss` has no owner to ask, and carries on without one.

#### 0.1 GitHub CLI

```bash
Expand Down
2 changes: 0 additions & 2 deletions emrg/server/paper_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ These instructions amend this task for one installation; they are not a second t

### 0. Phase Assessment (MUST run first every cycle)

**The round's first step is to call `boss`** — a separate session that owns this task's direction while this one does the work — and to treat its answer as the round's stance; whatever the answer does not mention is still this session's to decide. A session that is not offered `boss` has no owner to ask, and carries on without one.

Paper writing has four qualitatively distinct phases, each with its own goals, loop logic, and exit conditions. **Before starting this round's work, first determine which phase you are in**:

| Phase | Goal | Core Activity | Exit Condition |
Expand Down
2 changes: 0 additions & 2 deletions emrg/server/promote_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ These instructions amend this task for one installation; they are not a second t

Run this loop every round; never stop at "executed":

**The round's first step is to call `boss`** — a separate session that owns this task's direction while this one does the work — and to treat its answer as the round's stance; whatever the answer does not mention is still this session's to decide. A session that is not offered `boss` has no owner to ask, and carries on without one.

1. **Plan** — set this round's promotion intent: promote what, where, to whom (answer §5 question 1 before acting)
2. **Do** — execute the Participatory Four Steps
3. **Check** — **actively measure the effect** with quantifiable signals: star/fork deltas, article/blog exposure & interaction, comment interaction rate, platform/search ranking, feedback collected (see §6). Read the numbers yourself — do not wait for the host to point them out
Expand Down
41 changes: 0 additions & 41 deletions emrg/server/prompts/boss.j2

This file was deleted.

61 changes: 3 additions & 58 deletions emrg/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,9 @@ def session_dir(cwd: Path, session_id: str) -> Path:
This is the one producer of ``<cwd>/.emrg/sessions/<session_id>``. The rule has
more than one reader: ``Session`` fills the directory it computes here, and the
daemon derives a *parent's* directory from it to place a child's cwd inside —
``sub-agent/sub<N>`` for a delegation, ``sub-agent/sub-boss`` for an owner. A
caller that has an id and a cwd but no handle asks this, so a layout change is an
edit in one place rather than a search for every copy of the expression.
``sub-agent/sub<N>`` for a delegation. A caller that has an id and a cwd but no
handle asks this, so a layout change is an edit in one place rather than a
search for every copy of the expression.

The id is not validated here — ``is_safe_session_id`` decides that, and its caller
decides whether an unsafe id is refused or merely not a directory (see its
Expand Down Expand Up @@ -550,15 +550,6 @@ def __init__(self, session_id: str, agent: Agent | Path | str) -> None:
# `subagent` call reads this, and a daemon restart must not reset the
# count of a session that already exists on disk.
self._depth: int = 0
# When this session — acting as an owner — was last asked for a stance, in
# seconds since the epoch (issue #2495). An owner is left alone for
# `REASK_WINDOW_S` after a call, because direction does not change inside
# four hours and a second call buys the same judgement again. It lives in
# `meta.json` for the same reason `depth` does: the session is retained on
# disk, so a daemon restart that reset this clock would let the very next
# round re-buy a decision it already paid for.
self._boss_asked_at: float | None = None

# Lazy-initialized memory store
self._memory_store = None

Expand Down Expand Up @@ -698,15 +689,6 @@ def load(cls, session_id: str, cwd: Path) -> Session:
# a JSON `true` in this field would then read as depth 1.
if isinstance(stored_depth, int) and not isinstance(stored_depth, bool):
session._depth = max(0, stored_depth)
stored_boss_asked_at = meta.get("boss_asked_at")
# The same care as `depth`: `True` is an int, and a JSON `true` here
# would read as the epoch's first second. Absent, malformed and
# non-numeric all mean "never asked", which is the state that permits
# a call — the safe direction for a value that only ever blocks one.
if isinstance(stored_boss_asked_at, (int, float)) and not isinstance(
stored_boss_asked_at, bool
):
session._boss_asked_at = float(stored_boss_asked_at)
logger.info("session loaded: %s (%d messages)", session_id, session._message_count)
return session

Expand Down Expand Up @@ -775,39 +757,6 @@ def set_depth(self, depth: int) -> None:
self._save_meta()
logger.info("session delegation depth set: %s -> %d", self.session_id, self._depth)

# ── The owner's clock ─────────────────────────────────────

@property
def boss_asked_at(self) -> float | None:
"""When this session was last asked for a stance, or ``None`` if never.

Seconds since the epoch, so the quiet window's comparison is arithmetic
rather than a parse: a malformed instant would otherwise have to be told
apart from an absent one at the point where it decides something.
"""
return self._boss_asked_at

def set_boss_asked_at(self, when: float | None) -> None:
"""Persist the instant this session was last asked, into ``meta.json``.

The only writer of the key, and it is called *before* the owner's turn
runs rather than after it: a stamp written on completion leaves a turn that
died looking like one that never happened, and the next call would then pay
for the same judgement a second time.

``None`` clears it, and the key leaves ``meta.json`` with it — the state a
session that was never asked is in. That is how a call which delivered
nothing gives the window back (issue #2499): the clock exists to make a
direction that *was* given stand, and a call that was cancelled gave none.
"""
self._boss_asked_at = None if when is None else float(when)
self._save_meta()
logger.info(
"session owner clock set: %s -> %s",
self.session_id,
"never" if self._boss_asked_at is None else f"{self._boss_asked_at:.0f}",
)

# ── Sandbox tier ──────────────────────────────────────────

@property
Expand Down Expand Up @@ -1357,10 +1306,6 @@ def _save_meta_with_title(self, title: str | None) -> None:
# key saying it is zero deep.
if self._depth:
meta["depth"] = self._depth
# Same rule again: a session that was never asked for a stance must not
# gain a key claiming one was.
if self._boss_asked_at is not None:
meta["boss_asked_at"] = self._boss_asked_at
if title is not None:
meta["title"] = title
else:
Expand Down
Loading
Loading