feat(agents): git and communication rules from memory, backend hint hook

- Git section carries the rules that lived in auto-memory: push and PRs
  without asking, no --amend or stash pop with parallel sessions, absolute
  commit-message path, readable PR branches, push unsandboxed
- External communication: no notice on automated texts, terse PR replies,
  local time in chat
- Model selection: opus for research and judgement work; rule 0 for the
  self-hosted backend, fed by agents/backend-hint.sh as a SessionStart hook
  (prints a context line only when ANTHROPIC_BASE_URL is the vLLM gateway)

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UH8jPP1zXteddiR9pEd4KE
This commit is contained in:
mwiegand 2026-10-09 22:50:19 +02:00
parent b3432363ed
commit ba6f7521a1
No known key found for this signature in database
3 changed files with 43 additions and 2 deletions

View file

@ -46,9 +46,15 @@ Prefix every `Agent` prompt with one of:
Resolution order: explicit `model` param → agent type frontmatter → parent
inheritance. (`fork` always runs on the parent model; an override is ignored.)
0. **Self-hosted backend (a SessionStart hook says so when `ANTHROPIC_BASE_URL`
points at the vLLM gateway): never pass `model`.** Aliases like `sonnet`
do not exist there; every subagent inherits the one available model.
1. **Don't override specialized agent types** (`Explore`, `Plan`, etc.) — their frontmatter is tuned. Leave `model` off.
2. **For `general-purpose` under an expensive parent (Opus/Fable): set `model: sonnet`** — don't pay top rates for routine subagent work.
3. **A bigger model (`opus`)** on a subagent only when isolated context *and* reasoning beyond what the parent can easily do inline are both needed.
3. **`opus`** for research, recommendation, trade-off and judgement work
(also blinded eval judges) and when isolated context *and* reasoning beyond
the parent's inline capacity are both needed. For "how should X look"
questions discuss options first, do not build.
4. **`model: haiku`** only for mechanical tasks: bulk classification, format conversion, summarizing pre-filtered text. Code-semantic work → Sonnet.
### Context hygiene

View file

@ -33,7 +33,11 @@ pushes and memory writes do not need this.
a human. No social emojis, no emotional filler ("Danke dir! 🙂", "Huhu").
- Structure: factual salutation ("Hallo <Name>,"), precise content, concrete
call to action, closing without emotional markers.
- Append "(ai generated)" to every external text; never in chat replies to me.
- Append "(ai generated)" to every external text I phrase; never in chat
replies to me, and not in automated webhook or alert texts.
- PR thread replies carry only the decisive argument: no side findings,
links or follow-up ideas.
- Times in chat in Europe/Berlin local time; convert server UTC first.
## Error handling
@ -48,6 +52,26 @@ loop or brute-force through API calls.
- On a Jira issue, prefix the subject with its key (`IT-12345`) in every repo.
The ISAC repo has its own single-line convention (`IT-12345 bw/<bundle>:
<what>`, no Conventional Commits); the `isac` skill has the details.
- **Push and open PRs (also drafts) without asking**, then report the link.
Not covered: force-push, pushes to shared or foreign branches, merges, PR
comments. Exception: in the private l4d2 project Martin pushes himself.
- **Never `--amend` and never `git stash pop` when other sessions may work in
the same repo.** An amend rewrote another session's pushed commit once
(2026-09-25); a pop after "No local changes to save" pops a foreign stash,
in the ISAC repo one with staged secrets. Fix-ups are new commits; to look
at an old version use `git show <ref>:<path>`.
- **Commit messages via `-F` use one absolute path for writing and reading**
(the Bash tool's cwd changes silently; a relative `.tmp/commitmsg.txt` once
landed in a task folder and the commit took the old message). Check
`head -1` before committing; several commits per turn get numbered files.
- **Own PR branches: readable over historical.** Re-cut commits into one per
logical step (pure `git mv` first, content second) and push with
`--force-with-lease`; rebuild from the final tree instead of amending.
Bitbucket detects renames only by content similarity, so keep a renamed
file small.
- `git push` over SSH fails inside the sandbox (no raw TCP; `excludedCommands`
does not help): push with `dangerouslyDisableSandbox: true`, ISAC via
`isac git -C <repo>`.
## Jira

11
agents/backend-hint.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
# SessionStart hook: tell the agent when the session runs against the self-hosted
# vLLM gateway, where model aliases (sonnet, opus, haiku) do not exist.
# Prints nothing on Anthropic/Vertex so the default rules apply.
case "${ANTHROPIC_BASE_URL:-}" in
*vllm*|*seibert.tools*)
model="${ANTHROPIC_MODEL:-${CLAUDE_CODE_SUBAGENT_MODEL:-the configured model}}"
printf '{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"Self-hosted backend (%s): only %s is available. Never pass a model override to Agent calls; all subagents inherit this model."}}\n' "$ANTHROPIC_BASE_URL" "$model"
;;
esac
exit 0