@compilr-dev/sdk 0.10.37 → 0.10.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -152,12 +152,14 @@ IMPORTANT: Tool names are lowercase with underscores.
152
152
  export const TOOL_USAGE_HINTS_MODULE = {
153
153
  id: 'tool-usage-hints',
154
154
  name: 'Tool Usage Hints',
155
- estimatedTokens: 120,
155
+ estimatedTokens: 210,
156
156
  content: `## Tool Usage Hints
157
157
 
158
158
  - **bash background:** For long-running commands (builds, servers, watchers), set \`run_in_background: true\` and poll with \`bash_output\`. Never wait indefinitely.
159
159
  - **todo vs backlog:** \`todo_write\` is for ephemeral session tasks (lost on exit). For persistent project backlog, use \`workitem_*\` tools.
160
- - **Large files:** When reading files >500 lines, use \`maxLines\`/\`startLine\` to paginate. Avoid loading entire large files into context.
160
+ - **Large files search before reading:** For files >500 lines, use \`grep\` to find the symbol/line you need first, then \`read_file\` with \`startLine\`/\`maxLines\` to load just 30-60 lines of context around the hit. Reading whole large files burns context for little gain.
161
+ - **Compose multiple greps before reading:** When fixing something cross-cutting, run 2-3 \`grep\` calls to locate every relevant site, then read each in turn. Cheaper than re-reading after each find.
162
+ - **No re-read after edit:** \`edit\` succeeds atomically — if it returns without error, the change applied. Re-reading the file to verify wastes context.
161
163
  - **edit matching:** \`edit\` uses exact string matching. Provide enough surrounding context to make the match unique. If the match fails, read the file first to get the exact text.
162
164
  - **suggest quality:** Suggestions should be specific and actionable (e.g., "run npm test" not "continue working").`,
163
165
  };
@@ -181,8 +181,21 @@ export function createHandoffTool(config) {
181
181
  error: `Agent "${targetId}" not found in team. Available: ${available}`,
182
182
  };
183
183
  }
184
- // Enforce one-hop rule
185
- if (team.wasHandedTo(currentAgentId) && targetId !== 'default') {
184
+ // Enforce one-hop rule.
185
+ //
186
+ // Intent: prevent endless specialist chains ($arch → $dev → $qa → ...).
187
+ // A specialist that received a handoff can only hand back to the
188
+ // coordinator ($default) — completing one delegation cycle.
189
+ //
190
+ // The coordinator is exempt from the rule. When $default receives a
191
+ // handoff back from a specialist, the previous cycle is complete and
192
+ // the coordinator can route again freely. Without this exemption,
193
+ // group-chat usage breaks: $default hands to $dev, $dev hands back,
194
+ // $default tries to hand to $arch — and the rule wrongly fires
195
+ // because team.wasHandedTo('default') is now true.
196
+ if (currentAgentId !== 'default' &&
197
+ team.wasHandedTo(currentAgentId) &&
198
+ targetId !== 'default') {
186
199
  const source = team.getHandoffSource(currentAgentId);
187
200
  return {
188
201
  success: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.10.37",
3
+ "version": "0.10.39",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",