mirror of https://github.com/garrytan/gstack.git
fix: tool rewrites catch all 'Agent tool' phrasings across agent-runtime hosts
The Agent->host-tool rewrite only keyed on the exact literal 'use the Agent
tool', which never appears in generated content. Real phrasings ('using the
Agent tool', 'via the Agent tool', 'Use the Agent tool', and bare 'Agent tool')
slipped through, so the host's subagent tool never rendered and the Claude-ism
'Agent tool' leaked into generated docs (16x in hermes alone, delegate_task 0x).
Add article-first + bare-sweep rules to hermes (delegate_task), gbrain and
openclaw (sessions_spawn), and factory. Factory uses the plain noun 'delegation'
since its rewrites are prose, not tool names, which avoids echoing the
surrounding 'subagent' wording; a possessive-first rule handles "Claude Code's
Agent tool". Regenerated all four trees: 0 'Agent tool' leaks. Update the
factory ship golden baseline to match.
This commit is contained in:
parent
6209163900
commit
9c36fbdd22
|
|
@ -41,6 +41,12 @@ const factory: HostConfig = {
|
|||
'use the Agent tool': 'dispatch a subagent',
|
||||
'use the Grep tool': 'search for',
|
||||
'use the Glob tool': 'find files matching',
|
||||
// Agent tool: catch every phrasing, not just 'use the Agent tool'. Factory uses the plain
|
||||
// noun 'delegation' (reads clean mid-sentence without echoing the surrounding 'subagent'
|
||||
// prose); possessive form first, then article form, then a bare sweep.
|
||||
"Claude Code's Agent tool": 'delegation',
|
||||
'the Agent tool': 'delegation',
|
||||
'Agent tool': 'delegation',
|
||||
},
|
||||
|
||||
suppressedResolvers: ['GBRAIN_CONTEXT_LOAD', 'GBRAIN_SAVE_RESULTS'],
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ const gbrain: HostConfig = {
|
|||
'the Read tool': 'the read tool',
|
||||
'the Write tool': 'the write tool',
|
||||
'the Edit tool': 'the edit tool',
|
||||
// Agent tool: catch every phrasing (using/via/Use/bare), not just 'use the Agent tool'.
|
||||
// Article form first (drops 'the'), then a bare sweep for the article-less forms.
|
||||
'the Agent tool': 'sessions_spawn',
|
||||
'Agent tool': 'sessions_spawn',
|
||||
},
|
||||
|
||||
// GBrain gets brain-aware resolvers. All other hosts suppress these.
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@ const hermes: HostConfig = {
|
|||
'the Read tool': 'the read_file tool',
|
||||
'the Write tool': 'the patch tool',
|
||||
'the Edit tool': 'the patch tool',
|
||||
// Agent tool: catch every phrasing (using/via/Use/bare), not just 'use the Agent tool'.
|
||||
// Article form first (drops 'the' -> no dangling article), then a bare sweep for the
|
||||
// article-less forms ('via Agent tool', '(Agent tool', "Claude Code's Agent tool").
|
||||
'the Agent tool': 'delegate_task',
|
||||
'Agent tool': 'delegate_task',
|
||||
},
|
||||
|
||||
suppressedResolvers: [
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ const openclaw: HostConfig = {
|
|||
'the Read tool': 'the read tool',
|
||||
'the Write tool': 'the write tool',
|
||||
'the Edit tool': 'the edit tool',
|
||||
// Agent tool: catch every phrasing (using/via/Use/bare), not just 'use the Agent tool'.
|
||||
// Article form first (drops 'the'), then a bare sweep for the article-less forms.
|
||||
'the Agent tool': 'sessions_spawn',
|
||||
'Agent tool': 'sessions_spawn',
|
||||
},
|
||||
|
||||
// Suppress Claude-specific preamble sections that don't apply to OpenClaw
|
||||
|
|
|
|||
|
|
@ -1581,7 +1581,7 @@ If multiple suites need to run, run them sequentially (each needs a test lane).
|
|||
|
||||
## Step 7: Test Coverage Audit
|
||||
|
||||
**Dispatch this step as a subagent** using the Agent tool with `subagent_type: "general-purpose"`. The subagent runs the coverage audit in a fresh context window — the parent only sees the conclusion, not intermediate file reads. This is context-rot defense.
|
||||
**Dispatch this step as a subagent** using delegation with `subagent_type: "general-purpose"`. The subagent runs the coverage audit in a fresh context window — the parent only sees the conclusion, not intermediate file reads. This is context-rot defense.
|
||||
|
||||
**Subagent prompt:** Pass the following instructions to the subagent, with `<base>` substituted with the base branch:
|
||||
|
||||
|
|
@ -1839,7 +1839,7 @@ Repo: {owner/repo}
|
|||
|
||||
## Step 8: Plan Completion Audit
|
||||
|
||||
**Dispatch this step as a subagent** using the Agent tool with `subagent_type: "general-purpose"`. The subagent reads the plan file and every referenced code file in its own fresh context. Parent gets only the conclusion.
|
||||
**Dispatch this step as a subagent** using delegation with `subagent_type: "general-purpose"`. The subagent reads the plan file and every referenced code file in its own fresh context. Parent gets only the conclusion.
|
||||
|
||||
**Subagent prompt:** Pass these instructions to the subagent:
|
||||
|
||||
|
|
@ -2272,8 +2272,8 @@ Note which specialists were selected, gated, and skipped. Print the selection:
|
|||
|
||||
### Dispatch specialists in parallel
|
||||
|
||||
For each selected specialist, launch an independent subagent via the Agent tool.
|
||||
**Launch ALL selected specialists in a single message** (multiple Agent tool calls)
|
||||
For each selected specialist, launch an independent subagent via delegation.
|
||||
**Launch ALL selected specialists in a single message** (multiple delegation calls)
|
||||
so they run in parallel. Each subagent has fresh context — no prior review bias.
|
||||
|
||||
**Each specialist subagent prompt:**
|
||||
|
|
@ -2387,7 +2387,7 @@ Remember these stats — you will need them for the review-log entry in Step 5.8
|
|||
|
||||
**Activation:** Only if DIFF_LINES > 200 OR any specialist produced a CRITICAL finding.
|
||||
|
||||
If activated, dispatch one more subagent via the Agent tool (foreground, not background).
|
||||
If activated, dispatch one more subagent via delegation (foreground, not background).
|
||||
|
||||
The Red Team subagent receives:
|
||||
1. The red-team checklist from `$GSTACK_ROOT/review/specialists/red-team.md`
|
||||
|
|
@ -2477,7 +2477,7 @@ Save the review output — it goes into the PR body in Step 19.
|
|||
|
||||
## Step 10: Address Greptile review comments (if PR exists)
|
||||
|
||||
**Dispatch the fetch + classification as a subagent** using the Agent tool with `subagent_type: "general-purpose"`. The subagent pulls every Greptile comment, runs the escalation detection algorithm, and classifies each comment. Parent receives a structured list and handles user interaction + file edits.
|
||||
**Dispatch the fetch + classification as a subagent** using delegation with `subagent_type: "general-purpose"`. The subagent pulls every Greptile comment, runs the escalation detection algorithm, and classifies each comment. Parent receives a structured list and handles user interaction + file edits.
|
||||
|
||||
**Subagent prompt:**
|
||||
|
||||
|
|
@ -2550,7 +2550,7 @@ If `OLD_CFG` is `disabled`: skip Codex passes only. Claude adversarial subagent
|
|||
|
||||
### Claude adversarial subagent (always runs)
|
||||
|
||||
Dispatch via the Agent tool. The subagent has fresh context — no checklist bias from the structured review. This genuine independence catches things the primary reviewer is blind to.
|
||||
Dispatch via delegation. The subagent has fresh context — no checklist bias from the structured review. This genuine independence catches things the primary reviewer is blind to.
|
||||
|
||||
Subagent prompt:
|
||||
"Read the diff for this branch with `git diff origin/<base>`. Think like an attacker and a chaos engineer. Your job is to find ways this code will fail in production. Look for: edge cases, race conditions, security holes, resource leaks, failure modes, silent data corruption, logic errors that produce wrong results silently, error handling that swallows failures, and trust boundary violations. Be adversarial. Be thorough. No compliments — just the problems. For each finding, classify as FIXABLE (you know how to fix it) or INVESTIGATE (needs human judgment)."
|
||||
|
|
@ -3069,7 +3069,7 @@ git push -u origin <branch-name>
|
|||
|
||||
## Step 18: Documentation sync (via subagent, before PR creation)
|
||||
|
||||
**Dispatch /document-release as a subagent** using the Agent tool with `subagent_type: "general-purpose"`. The subagent gets a fresh context window — zero rot from the preceding 17 steps. It also runs the **full** `/document-release` workflow (with CHANGELOG clobber protection, doc exclusions, risky-change gates, named staging, race-safe PR body editing) rather than a weaker reimplementation.
|
||||
**Dispatch /document-release as a subagent** using delegation with `subagent_type: "general-purpose"`. The subagent gets a fresh context window — zero rot from the preceding 17 steps. It also runs the **full** `/document-release` workflow (with CHANGELOG clobber protection, doc exclusions, risky-change gates, named staging, race-safe PR body editing) rather than a weaker reimplementation.
|
||||
|
||||
**Sequencing:** This step runs AFTER Step 17 (Push) and BEFORE Step 19 (Create PR). The PR is created once from final HEAD with the `## Documentation` section baked into the initial body. No create-then-re-edit dance.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue