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
52 changes: 26 additions & 26 deletions emrg/server/open_source_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ gh auth status 2>&1 || {
TOKEN=$(printf "protocol=https\nhost=github.com\n\n" | git credential fill 2>/dev/null | grep '^password=' | cut -d= -f2-)
if [ -n "$TOKEN" ]; then
export GH_TOKEN="$TOKEN"
echo "gh 未认证 — 已从 git 凭据提取 token (GH_TOKEN)"
echo "gh not authenticated — token extracted from git credentials (GH_TOKEN)"
gh auth status 2>&1
fi
else
echo "gh 未认证 — 请在 EMRG GUI 设置页连接 GitHub(无需终端)"
echo "gh not authenticated — connect GitHub from the EMRG GUI settings page (no terminal needed)"
fi
}
```
Expand Down Expand Up @@ -115,20 +115,20 @@ cd {{ source_dir }} && git status --short --branch 2>&1
#### 0.4 Read the state file

```bash
cat {{ evolution_cwd }}/open_source_{{ owner }}_{{ repo }}_state.md 2>/dev/null || echo "[新状态文件]" > {{ evolution_cwd }}/open_source_{{ owner }}_{{ repo }}_state.md
cat {{ evolution_cwd }}/open_source_{{ owner }}_{{ repo }}_state.md 2>/dev/null || echo "[new state file]" > {{ evolution_cwd }}/open_source_{{ owner }}_{{ repo }}_state.md
```

State file format:

```markdown
# Open-Source State: {{ owner }}/{{ repo }}
- 角色: Committer | Contributor
- 当前阶段: 准备 | 侦察 | 贡献 | 追踪 | 审查
- 上次完成: <上一轮做了什么>
- 活跃PR: <自己的 open PR 列表,每行一个>
- 进行中: <正在实现的内容 | 无>
- 下一步: <本轮计划做什么>
- 阻塞: <什么在阻止进展?空=无阻塞>
- role: Committer | Contributor
- current stage: Prep | Recon | Contribute | Track | Review
- last completed: <what was done last round>
- active PRs: <own open PR list, one per line>
- in progress: <what is being implemented | none>
- next step: <what this round plans to do>
- blocked: <what is blocking progress? empty = no blocker>
```

#### 0.5 Rant scan (host development instructions)
Expand Down Expand Up @@ -178,10 +178,10 @@ cd {{ source_dir }} && git log --oneline -20
Unhandled rant found in 0.5 (project matches, pending/in_progress, dedup check passed)?
→ Phase Contribution (handle the rant — host instruction, highest priority)

Is "进行中" (in progress) in the state file non-empty?
Is "in progress" non-empty in the state file?
→ Phase Contribution (continue the unfinished implementation)

Are there open items in "活跃PR" (active PRs)?
Are there open items in "active PRs"?
→ Phase Tracking (check PR status, respond to reviews)

No active work?
Expand Down Expand Up @@ -262,11 +262,11 @@ When Phase Contribution is entered because an **unhandled rant** (project-matchi
```bash
cd {{ source_dir }}
# Read the contributing guide (if present)
cat CONTRIBUTING.md 2>/dev/null || echo "[ CONTRIBUTING.md]"
cat CONTRIBUTING.md 2>/dev/null || echo "[no CONTRIBUTING.md]"
# Read the PR template (if present)
cat .github/pull_request_template.md 2>/dev/null || echo "[ PR 模板]"
cat .github/pull_request_template.md 2>/dev/null || echo "[no PR template]"
# Check for other convention files
ls .github/ 2>/dev/null || echo "[ .github 目录]"
ls .github/ 2>/dev/null || echo "[no .github directory]"
```

Extract from these files and strictly follow:
Expand All @@ -282,18 +282,18 @@ Extract from these files and strictly follow:

#### B.2b Read the full codebase (MUST before contributing)

> ⚠️ 前提:**每次贡献前都重新读取最新代码**(0.3 Source sync 已保证 `git pull` 到最新;任何贡献思路都建立在你刚拉取的最新代码上,不得用记忆/旧版本代码做判断)。
> ⚠️ Prerequisite: **re-read the latest code before every contribution** (0.3 Source sync guarantees `git pull` to latest; any contribution idea must be built on the code you just pulled — never on memory or stale code).

**读完整代码**(不止是目标文件):
- 先看仓库根:README / docs / 目录结构 → 理解项目定位、模块划分
- 通读核心模块源码(按目录树从上到下,理解每个模块职责)
- 定位到与本次 Issue/目标相关的代码时,**精读相关文件全文**(不只看改动点附近)
**Read the full codebase** (not just the target files):
- Start at the repo root: README / docs / directory structure → understand the project's positioning and module layout
- Read through the core module sources (top-down through the directory tree, understanding each module's responsibility)
- When you locate the code relevant to this Issue/goal, **read the full relevant files closely** (not just around the change point)

**repository 作者的视角理解设计意图**:
- 问自己:作者为什么这样设计?这个函数/模块解决什么问题?为什么用这个模式(而非别的方式)?
- 读提交历史 / git blame:理解代码演化脉络,不臆测作者意图
- 设计意图不明 → 读测试(测试即文档),读 Issue/讨论记录
- **只有当你理解了作者的设计意图,才考虑怎么贡献** —— 贡献必须顺应既有设计,而不是另起炉灶
**Understand the design intent from the repository author's perspective**:
- Ask yourself: why did the author design it this way? What problem does this function/module solve? Why this pattern (vs. another way)?
- Read commit history / git blame: understand the code's evolution, don't guess the author's intent
- Unclear intent → read the tests (tests are docs), read Issues/discussion records
- **Only when you understand the author's design intent should you consider how to contribute** — contributions must follow the existing design, not start from scratch

#### B.3 Fork and branch

Expand Down Expand Up @@ -323,7 +323,7 @@ cd {{ source_dir }}
# - Go: go test ./... 2>&1 || echo "⚠️ test failures"
#
# 2. If the project has no tests → at least manually verify the change:
python -c "<验证代码片段>" 2>&1 || echo "⚠️ verification failed"
python -c "<verification code snippet>" 2>&1 || echo "⚠️ verification failed"
```

- Tests failing → fix the code → re-test → until passing. **Never submit code that fails tests.**
Expand Down
20 changes: 10 additions & 10 deletions emrg/server/paper_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ At the start of every cycle, you MUST read `{{ source_dir }}/.emrg/sessions/{{ s

```markdown
# Paper State
- 当前阶段: Phase 2 | 3 | 4
- 上次完成: <上一轮做了什么>
- 下一步: <本轮计划做什么>
- 阻塞: <什么在阻止进展?空=无阻塞>
- 未处理 Rant: <相关 rant 的时间戳和摘要,无则写"无">
- current phase: Phase 2 | 3 | 4
- last completed: <what was done last round>
- next step: <what this round plans to do>
- blocked: <what is blocking progress? empty = no blocker>
- unhandled rants: <timestamps and summaries of relevant rants, "none" if none>
```

At the end of every cycle, update `{{ source_dir }}/.emrg/sessions/{{ session_id }}/paper_state.md`. This solves the cross-cycle memory problem — each new conversation gets "where we left off" from the state file instead of guessing from memory.
Expand Down Expand Up @@ -115,7 +115,7 @@ Handling rules:
**Read the state file** (MUST run first):

```bash
cat {{ source_dir }}/.emrg/sessions/{{ session_id }}/paper_state.md 2>/dev/null || echo "## Paper State\n- 当前阶段: Phase 1\n- 上次完成: 无\n- 下一步: 探索研究方向\n- 阻塞: 无" > {{ source_dir }}/.emrg/sessions/{{ session_id }}/paper_state.md
cat {{ source_dir }}/.emrg/sessions/{{ session_id }}/paper_state.md 2>/dev/null || echo "## Paper State\n- current phase: Phase 1\n- last completed: none\n- next step: explore research direction\n- blocked: none" > {{ source_dir }}/.emrg/sessions/{{ session_id }}/paper_state.md
```

Perform different review operations based on the current phase:
Expand All @@ -139,7 +139,7 @@ Check paper-related files under the project directory `{{ source_dir }}`:

1. **First list already-read literature** (avoid duplicates):
```bash
ls {{ source_dir }}/literature/ 2>/dev/null || echo " literature/ 目录(尚未开始文献工作)"
ls {{ source_dir }}/literature/ 2>/dev/null || echo "[no literature/ directory — literature work has not started]"
```
2. **Prefer the browser harness skill** to access arXiv (cs.LG, cs.CL, cs.AI) and search for new preprints from the last 6 months related to the research direction
3. **If browser harness is unavailable**, fall back to bash + curl calling the arXiv API. Keywords MUST derive from the project's research direction (read Agent.md / abstract / state file to determine direction terms, e.g. mutual learning, co-teaching, self-play, knowledge distillation); using generic broad terms is forbidden:
Expand Down Expand Up @@ -182,7 +182,7 @@ Based on the current phase and review results, determine this round's goal:
if which latexmk >/dev/null 2>&1; then
cd {{ source_dir }} && latexmk -pdf -interaction=nonstopmode main.tex 2>&1 | tail -20
else
echo "latexmk 不可用——跳过编译,改为文本级检查(交叉引用/参考文献编号一致性)"
echo "latexmk unavailable — skipping compilation, falling back to text-level checks (cross-reference / bibliography numbering consistency)"
fi
```

Expand All @@ -197,10 +197,10 @@ import json, os
rants_file = os.path.expanduser("~/.emrg/rants.jsonl")
rants = [json.loads(l) for l in open(rants_file) if l.strip()]
for i, r in enumerate(rants):
if r.get("status") == "pending" and "本轮已处理的 rant 的 timestamp":
if r.get("status") == "pending" and "<timestamp of the rant handled this round>":
r["status"] = "acknowledged"
r["completed"] = "<ISO timestamp>"
# 重建字段顺序:timestamp → project → status → progress → completed → message
# Rebuild field order: timestamp → project → status → progress → completed → message
rants[i] = {
"timestamp": r.get("timestamp"),
"project": r.get("project"),
Expand Down
Loading
Loading