Keep dabit3/sonic-agent caught up with upstream NousResearch/hermes-agent every day.
If there are new upstream commits, produce ONE open PR into main that merges those
changes while preserving Sonic-specific branding and speed work. Verify with tests,
leave proof in the PR, self-review the PR, and stop so the human only has to review/merge
the morning PR.
If there is nothing new upstream, do NOT open a PR. Leave a short “no upstream changes” note and end the session.
- This repo:
dabit3/sonic-agent(default branchmain) - Upstream:
https://github.com/NousResearch/hermes-agent.git(branchmain) - Sonic is a fork of Hermes optimized for speed (startup, TTFT, streaming).
Fork identity must survive the merge:
- CLI / package / paths:
sonic,sonic-agent,~/.sonic,SONIC_* - NOT
hermes,hermes-agent,~/.hermes,HERMES_*(except intentional upstream docs links) - Speed profile / latency work in config and code must be preserved
- README fork badge and “fork of Hermes” messaging must stay Sonic’s, not stock Hermes branding
- CLI / package / paths:
- Canonical tests:
scripts/run_tests.sh(matches CI; do not invent a different pytest invocation) - CI installs with:
uv venv .venv --python 3.11 && source .venv/bin/activate && uv pip install -e ".[all,dev]"
- Work only in
dabit3/sonic-agent. git fetch originand start from latestorigin/main.- Ensure upstream remote exists:
git remote add upstream https://github.com/NousResearch/hermes-agent.gitif missinggit fetch upstream --tags
- Record baselines:
SONIC_BASE=$(git rev-parse origin/main)UPSTREAM_HEAD=$(git rev-parse upstream/main)- Last synced upstream SHA if discoverable from prior sync PR/branch notes; otherwise compute merge-base:
MERGE_BASE=$(git merge-base origin/main upstream/main)
- If
origin/mainalready containsupstream/main(merge-base == upstream/main, or no commits inupstream/main..relative to integration point), STOP:- Write a short status: date, upstream SHA, “no new upstream commits”
- Do not create a branch, PR, or empty commit
- If an open PR already exists for today’s sync (title prefix
chore(upstream):and body contains the same upstream range), reuse it — update that branch instead of opening a duplicate - Otherwise continue
- Branch name:
chore/upstream-hermes-YYYY-MM-DD(UTC date) - Base:
origin/main - Prefer a merge of
upstream/maininto the branch (preserves history). Use rebase only if merge is clearly worse. - Command sketch:
git checkout -B chore/upstream-hermes-YYYY-MM-DD origin/maingit merge upstream/main(allow conflicts)
When resolving conflicts, apply this priority order:
- Keep Sonic branding & identity (names, paths, CLI entry points, docs that describe Sonic)
- Keep Sonic speed-profile / latency behavior unless upstream fix is clearly a bugfix in the same code and can be ported without dropping speed semantics
- Take upstream bugfixes, security fixes, new features, tests, and refactors when they don’t fight (1)/(2)
- Re-apply rename invariants after conflict resolution (search the diff):
- User-facing CLI must remain
sonic(pyproject scripts, help text, install scripts) - Home/config dir
~/.sonic/get_sonic_home()patterns — do not reintroduce~/.hermes - Package/distribution name stays sonic-agent where Sonic already diverged
- Do NOT blindly replace every “Hermes” string: keep attribution (“fork of Hermes Agent”) and upstream doc links
- User-facing CLI must remain
- Prefer small, reviewable conflict resolutions over large rewrites
- If a conflict is too ambiguous to resolve safely, leave a clear
TODO(upstream-sync):comment AND list it in the PR under “Needs human judgment” — but still finish everything else you can
Run searches on the working tree / diff vs origin/main and fix accidental upstream leakage:
- Branding regressions: new
hermesCLI references,~/.hermes,HERMES_HOME, package name flips, install URLs pointing at NousResearch/hermes-agent for this project’s install path - Preserve Sonic README positioning and speed section
- Ensure
pyproject.tomlscripts still exposesonic,sonic-agent,sonic-acpas before unless upstream added a net-new entry point that should be added under Sonic naming - Update lockfiles only if dependencies changed (
uv lock/ project’s normal lock workflow) - Do not commit secrets, local venv, or unrelated dirty files
Install if needed (fresh env ok):
uv venv .venv --python 3.11source .venv/bin/activateuv pip install -e ".[all,dev]"
Then run verification in this order; capture logs:
- Import/smoke
python -c "import sonic_cli, run_agent; print('ok')"- Confirm CLI entry:
sonic --help(or module equivalent if path setup requires it)
- Targeted tests for touched areas
- From the merge diff, identify highest-risk packages (agent/, gateway/, tools/, sonic_cli/, ui-tui/, tui_gateway/)
- Run focused tests first, e.g.
scripts/run_tests.sh tests/<affected> -j 4
- Broader suite
- Prefer
scripts/run_tests.sh -j 4for a substantial run - If full suite is too long for the session, run a wide slice covering affected areas + a representative core set, and state exactly what ran vs skipped
- Prefer
- Lint/type only if cheap and relevant to touched files — don’t block the PR on unrelated repo-wide lint debt
- Fix failures caused by the merge. Do not weaken or delete tests to “make green” unless the test is Hermes-branding-specific and must be updated to Sonic naming — in that case update the test, don’t delete coverage.
If tests fail and you cannot fix within reasonable effort:
- Still open the PR as draft if code merged
- Mark clearly FAILING with logs
- Do not claim success
Review your own PR diff as a skeptical maintainer:
- Correctness of conflict resolutions
- No accidental rebrand-to-Hermes
- No dropped Sonic speed behavior without justification
- No unrelated refactors
- Tests adequate for the risk
- Security-sensitive paths (auth, shell, gateway, install scripts) get extra scrutiny
Leave a PR review comment (or PR body section) titled Devin self-review with:
- Summary of upstream range merged (SHAs + commit count + highlights)
- Conflict hotspots and how they were resolved
- Branding/speed preservation checks performed
- Test commands + pass/fail counts
- Residual risks / “Needs human judgment” items
- Push branch to
origin - Open PR into
main(or update existing sync PR) - Title:
chore(upstream): sync Hermes <short-sha> (YYYY-MM-DD) - Body must include:
## Summary
Daily upstream sync from `NousResearch/hermes-agent` into Sonic.
- Upstream range: `<merge_base_or_previous>..<upstream_sha>`
- Upstream commits: N
- Highlights:
- …
- Sonic-preserving decisions:
- …
## Proof
- Smoke: …
- Tests run: exact commands
- Results: pass/fail counts (paste key tail of log)
- CI: link once available
## Self-review
- …
- Needs human judgment: …
## Test plan
- [ ] `scripts/run_tests.sh …` (commands actually run)
- [ ] Branding grep clean for accidental hermes regressions
- [ ] Speed profile / Sonic identity intact- Add label if available:
upstream-sync - Request reviewers only if repo convention requires it; otherwise leave for the human morning review
- Do not merge the PR
- Do not force-push after the PR is opened unless fixing a critical issue you just introduced
- Final message in the Devin session: PR URL + one-screen status (synced range, tests, residual risks)
- Either (A) no upstream changes and no PR, with a clear status note, OR (B) exactly one sync PR open/updated for this run
- PR merges upstream
maininto Sonicmainon a dated branch - Sonic branding, CLI, and
~/.sonicidentity preserved - Speed-oriented Sonic behavior not silently reverted
- Proof of verification is in the PR body (commands + results)
- Self-review section present
- PR is not merged by Devin
- No secrets committed; no destructive git history rewrites on
main
- Optimize for a PR a human can review in ≤15 minutes: crisp summary, conflict notes, proof
- Upstream moves fast; favor merging today’s delta cleanly over boiling the ocean
- When upstream renames/refactors large files, merge first, then re-apply Sonic deltas rather than hand-replaying commits
- For ui-tui/TS changes: run the package’s existing
npm test/npm run type-checkif JS/TS was touched and deps allow - If yesterday’s sync PR is still open and unmerged, continue on that branch (include new upstream commits) instead of stacking multiple daily PRs
- Quote exact SHAs everywhere — never say “latest” without a SHA
- Keep commits on the branch coherent; a single merge commit + follow-up fix commits is fine
- Do not merge the PR to
main - Do not force-push
mainor rewrite published history - Do not close/supersede unrelated human PRs
- Do not “fix” tests by deleting assertions or skipping broad suites with
pytest -khacks that hide failures - Do not rebrand the project back to Hermes
- Do not change GitHub remote to make Sonic track hermes-agent as origin
- Do not spend the whole session on unrelated refactors, dependency upgrades beyond what upstream brought, or docs rewrites
- Do not run destructive data deletion or production deploys
- Repo access to
dabit3/sonic-agentwith permission to push branches and open PRs - Schedule/automation attached to this playbook (daily morning)
- Human reviews/merges the PR (that is the only ongoing job)
- Create a Playbook in Devin from this file (or drag-and-drop
daily-hermes-sync.devin.mdwhen starting a session). - Create an Automation with a Schedule trigger (e.g. daily morning cron
0 7 * * *in your TZ). - Attach this playbook; set the repo to
dabit3/sonic-agent. - Optional session prompt each run:
Run the daily Hermes upstream sync playbook. - Each morning: open the PR (if any), review Devin’s self-review + proof, merge.