emrg: memory reflection tool log — session id + round + truncation marker - #815
emrg: memory reflection tool log — session id + round + truncation marker#815argszero wants to merge 1 commit into
Conversation
…tion marker Host rant 2026-08-17T12:00:35: 'memory reflection tool: bash → ---' was unclear — no context (which background task), no session id (other lines in the same function carry id=%s round=%d), and the truncated '---' looked like meaningless output rather than the first 100 chars of a YAML frontmatter. - Prefix unified to 'memory reflection:' (matches sibling logs) - Added id=<session_id> round=<n> (the for-loop round, 1-based) - Result truncated to 100 chars with a '…' suffix when longer, so it is unambiguous that the output was cut. Example: memory reflection: id=s_xxx round=2 tool bash → ---… No test changes (log-only).
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (self-review): log-only change; prefix unified to memory reflection: with id/round, 100-char truncation gains a … marker. Sibling logs already carry id/round — consistent. No test impact.
|
Superseding this PR: the same memory-reflection log fix (id/round/truncation marker) is now contained in #814 (feature/submit-rant-tool), which additionally adds the tool |
… 2026-08-17T12:03:13)
Host: every agent tool log should output 'tool name + human-readable
purpose' so background calls (memory reflection / consolidation) are
understandable without context. Also submit_rant's project becomes
REQUIRED (host 12:00 demand folded into this rant).
- ToolDefinition gains purpose: human-friendly one-line purpose
(logs/UI); description stays for LLM routing.
- All 7 tools (bash/read/write/edit/glob/grep/submit_rant) get a purpose.
- Log sites now print 'name — purpose (args)':
* main loop: 'tool call: bash — 执行 shell 命令并返回输出 ({command: ...})'
* memory reflection: 'memory reflection: id= round= tool name — purpose → out…'
* consolidation: 'consolidation tool: name — purpose → out…'
(unknown tool → purpose 'unknown tool'; tool mocks in tests updated)
- submit_rant: parameters.required now ['project','message']; execute
rejects empty project with 'ask the user which project this rant targets'.
- system.j2 Rant Handling: tool requires project — ask user if unknown.
Also covers rant 2026-08-17T12:00:35 (memory reflection log id/round/
truncation marker) — same log line, superset, #815 closed.
+2 tests (project-required, all-tools-have-purpose), Agent.md 841→843.
|
I tested PR #815 end-to-end (checked out
One non-blocking observation for a future slice: the |
…hen-write) (#814) * emrg: submit_rant tool + rant in normal conversation (rant 2026-08-17T11:51:59) Host: a rant is not a special mode — it is a normal part of conversation. The user may complain/suggest in plain speech; the agent should detect rant intent, clarify/polish, get explicit consent, then write it. - New emrg/server/rants.py: append_rant() shared write logic (field order timestamp → project → status → progress → completed → message, tz-aware daemon-authoritative timestamp, sorted rewrite) — extracted from the daemon rant handler, single source of truth. - New emrg/tools/submit_rant_tool.py: SubmitRantTool registered in the daemon tool registry (available in every session); description mandates explicit user consent before calling; project optional (default = emrg). - daemon.py rant handler now delegates to append_rant (identical behavior). - system.j2: new 'Rant Handling' section — recognition (no /rant prefix needed), confirm → clarify → polish → show → call submit_rant; never call without explicit agreement; /rant <msg> and GUI panel are explicit. - TUI /rant <msg> / /rant @Proj <msg> no longer write directly: routes through the agent as a normal task with a '[Host wants to submit this rant…]' hint (agent confirms + calls submit_rant). GUI panel keeps the direct write (explicit form submit = confirmed). - +7 tests (append_rant sort/field-order/corrupt-skip, tool write/count, empty-message error, definition consent contract, system.j2 section, tool registered). Agent.md 834→841. * emrg: tool purpose field in logs + submit_rant project required (rant 2026-08-17T12:03:13) Host: every agent tool log should output 'tool name + human-readable purpose' so background calls (memory reflection / consolidation) are understandable without context. Also submit_rant's project becomes REQUIRED (host 12:00 demand folded into this rant). - ToolDefinition gains purpose: human-friendly one-line purpose (logs/UI); description stays for LLM routing. - All 7 tools (bash/read/write/edit/glob/grep/submit_rant) get a purpose. - Log sites now print 'name — purpose (args)': * main loop: 'tool call: bash — 执行 shell 命令并返回输出 ({command: ...})' * memory reflection: 'memory reflection: id= round= tool name — purpose → out…' * consolidation: 'consolidation tool: name — purpose → out…' (unknown tool → purpose 'unknown tool'; tool mocks in tests updated) - submit_rant: parameters.required now ['project','message']; execute rejects empty project with 'ask the user which project this rant targets'. - system.j2 Rant Handling: tool requires project — ask user if unknown. Also covers rant 2026-08-17T12:00:35 (memory reflection log id/round/ truncation marker) — same log line, superset, #815 closed. +2 tests (project-required, all-tools-have-purpose), Agent.md 841→843. * test: append_rant sort test uses host-local offset (UTC CI fix) The older-rant fixture hardcoded a +08:00 timestamp; on UTC CI hosts the daemon writes +00:00, so the lexicographic string sort puts the new entry first and the order assertion failed. Production is unaffected (all rants share the host offset), but the test must too — compute the older timestamp as now - 1h in the host's own tz. Verified under TZ=UTC and TZ=Asia/Shanghai. --------- Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Host rant 2026-08-17T12:00:35:
memory reflection tool: bash → ---in emrgd.log is unclear — no context (which background task), no session id (sibling logs carryid=%s round=%d), and the truncated---looks like meaningless output rather than the first 100 chars of a YAML frontmatter.Change (log-only, 6+/1-):
memory reflection:(matches sibling logs in_maybe_reflect_memory)id=<session_id> round=<n>(1-based tool-loop round)…suffix when longer — unambiguous that the output was cutNew form:
memory reflection: id=s_xxx round=2 tool bash → ---…No test changes (Agent.md count unchanged).