refactor(server): restructure agent launch guidance as numbered list - #400
Merged
Conversation
Rewrites the launch-time startup rules from a single run-on paragraph
into a scannable numbered list, and rephrases the session-rename rule
in active voice with a concrete trigger ("As soon as you understand
the user's concrete task — typically on your first substantive reply").
The old phrasing — "If your session still has the default generated
name, wait until you understand the user's concrete task, then call
dispatch_rename_session…" — buried the instruction mid-paragraph as
a deferred conditional, competing with surrounding active-voice
mandates (dispatch_event, dispatch_pin, create_pr). Agents were
skimming past it.
No change in meaning or tool usage; token cost is within 1%.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds two structural assertions to agent-manager.test.ts so a
regression that silently re-joined the rules array into a paragraph
(e.g. swapping .join("\n") for .join(" ")) would fail the suite.
Addresses architecture-review feedback on PR #400.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adjustments to the session-rename rule added in the previous commit: - Drop "concrete task" in favor of "topic of work … topic, task, or feature." The name describes the subject of the session, not a rigidly-defined unit of work. - Drop "typically on your first substantive reply" — premature for sessions where the topic takes a few turns of back-and-forth to surface. - Drop "call … once" and "Don't rename again unless the user starts a separate task or explicitly asks." Replace with explicit permission to rename if the work shifts substantially to a new topic. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rewrites the startup rules that Dispatch injects into every agent launch from a single run-on paragraph into a scannable numbered list, and rephrases the session-rename rule in active voice with a concrete trigger.
The session-rename instruction had degraded over time — agents were skimming past it because:
dispatch_event,dispatch_pin,create_pr, AutoReview flow, etc.).dispatch_eventanddispatch_pin, it's not reinforced inCLAUDE.mdorAGENTS.md.Changes:
apps/server/src/agents/manager.ts: builds rules as astring[], numbers them on output. Rename is now rule fix(web): catch agent-status API failure during terminal reconnect #2, phrased actively: "Name the session. As soon as you understand the user's concrete task — typically on your first substantive reply — call dispatch_rename_session once…". Same rules, same meaning, just structured.apps/server/test/db/agent-manager.test.ts: three assertions updated to match the new wording.Token cost is within ~1% of the old prose (~20 extra tokens for the numbering).
Test plan
pnpm run check— server + web type checkpnpm --filter @dispatch/server test— 431 passing, 11 skippedpnpm run test:e2e— 144 passing, 6 skipped🤖 Generated with Claude Code