mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-05 14:35:17 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The `hermes_local` adapter runs the Hermes CLI and reads its stdout > - The adapter uses the stdout before `session_id:` as the run result. Paperclip posts this result as an auto-comment when the agent does not post its own comment. > - The Hermes gateway client prints the inline diff of each edit behind a `│` gutter. It does this also in quiet mode (`-Q`) and with `display.inline_diffs: false`. > - `cleanResponse()` does not remove these lines. The run summary and the auto-comment then contain only code diffs, cut at 2,000 characters. > - The live issue chat uses `parseHermesStdoutLine()`. This parser shows the same lines as assistant text, so the agent appears to "speak" diffs. > - This pull request removes the gutter lines from the result and classifies them as stdout in both UI parsers (TypeScript and `ui-parser.cjs`). > - The benefit is that auto-comments and the issue chat show what the agent wrote, not raw diffs. ## Linked Issues or Issue Description No issue exists. I searched open and closed issues and PRs for "hermes diff", "hermes cleanResponse" and Hermes adapter PRs. I found no duplicate. **What happened?** An agent on `hermes_local` ran through the Hermes gateway client. When a run ended without an agent comment (timeout or interrupted run), Paperclip posted an auto-comment (`authorizationReason: internal_agent_write`). The comment contained only diff lines such as `│ apps/web/... │`, `│ @@ -1,2 +1,3 @@`, `│ +...`. The live issue chat showed the same lines as assistant messages. **Expected behavior** The auto-comment contains the agent's final text only. The issue chat shows diff lines as tool output, not as assistant speech. **Steps to reproduce** 1. Configure an agent with `hermes_local` and a Hermes setup that uses the gateway client. 2. Give the agent a task that edits files. 3. Let the run end without an agent comment (for example, a timeout). 4. Look at the auto-comment and at the live issue chat during the run. **Agent adapter(s) involved** Hermes ## What Changed - `packages/adapters/hermes/src/server/execute.ts`: `cleanResponse()` removes lines that start with `│` after ANSI codes are removed. - `packages/adapters/hermes/src/ui/parse-stdout.ts`: `parseHermesStdoutLine()` returns `stdout` for lines that start with `│`. Before, they became `assistant`. - `packages/adapters/hermes/ui-parser.cjs`: the same rule for the CJS parser. Externally installed adapters load this file. - New test `src/ui/ui-parser-cjs.test.ts`: tests the exported `parseStdoutLine` from `ui-parser.cjs`. - New test `src/server/execute.response.test.ts`: runs `execute()` with Hermes stdout that has gutter diff lines. It checks `summary` and `resultJson.result`. - New tests in `src/ui/parse-stdout.test.ts` for plain and colored gutter lines. ## Verification - `pnpm --filter @paperclipai/hermes-paperclip-adapter test`: 12 files, 180 tests pass. - `pnpm --filter @paperclipai/hermes-paperclip-adapter typecheck`: pass. - The five new parser and execute tests fail without the source change and pass with it. - Manual: I applied the same change to the built adapter on a live instance (2026.1023.0). After a restart, auto-comments from a Hermes agent contained the final text only. The issue chat stopped showing diff lines as assistant text. ## Risks - Low risk. The change affects only lines whose first visible character is `│` (U+2502). - If an agent writes a final answer line that starts with `│`, the adapter now removes that line from the result. This is unlikely in normal prose. The `┊` (U+250A) tool lines are not affected. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use (shell, file edits, test runs). The model found the cause, wrote the change and the tests, and wrote this description. A human reviewed and approved the work. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] I have updated relevant documentation to reflect my changes (not applicable: no documented behavior changes) - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Thomas Venturini <4708070+tjventurini@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>