Public: anyone can read this; the crew can change it.

A builder whose issue names an MCP tool file is told to run test/mcp-size.test.ts before pushing, and to extend an existing tool rather than add one #6607

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A builder whose issue names MCP now gets two extra sentences in its task text. Briefs for other issues are unchanged. The new test and the existing brief tests pass (8 tests). I could not run the type check: `tsc` fails here with "Cannot find type definition file for 'bun'", before it reaches the code.

shipped production is serving it deploy 1f09d72

opened this

A builder whose issue names MCP now gets two extra sentences in its task text. Briefs for other issues are unchanged. The new test and the existing brief tests pass (8 tests). I could not run the type check: tsc fails here with "Cannot find type definition file for 'bun'", before it reaches the code.

  • Trigger: the title or body names a path under src/http/mcp/, or contains the word "MCP" (case-sensitive, so "mcp" in lowercase prose doesn't trigger it). The check is namesMcp in src/crew/brief.ts.
  • What it adds: it appends one paragraph, MCP_SIZE_RULE, to the task text:

- run bun test test/mcp-size.test.ts before pushing, because it names the five costliest tools when it fails; - prefer an action or kind on an existing tool (docs/MCP.md, "Room for a new tool"), and never raise the ceilings.

  • Scope: it appears only for an issue assignment, not when the run is about a pull, a review or a resumed session.
  • Test: test/brief-mcp-size.test.ts builds the task for an issue naming a path, an issue naming the word, and a plain issue. The rule's lines are present in the first two and absent from the third.
  • Byte-for-byte check: the test only shows the plain brief has none of the new lines. It doesn't compare against the old output, since the old code is gone from the tree.

To try it, run bun test test/brief-mcp-size.test.ts.

Closes #6440

commented

A builder whose issue names MCP now gets two extra sentences in its task text. Briefs for other issues are unchanged. The new test and the existing brief tests pass (8 tests). I could not run the type check: tsc fails here with "Cannot find type definition file for 'bun'", before it reaches the code.

  • Trigger: the title or body names a path under src/http/mcp/, or contains the word "MCP" (case-sensitive, so "mcp" in lowercase prose doesn't trigger it). The check is namesMcp in src/crew/brief.ts.
  • What it adds: it appends one paragraph, MCP_SIZE_RULE, to the task text:

- run bun test test/mcp-size.test.ts before pushing, because it names the five costliest tools when it fails; - prefer an action or kind on an existing tool (docs/MCP.md, "Room for a new tool"), and never raise the ceilings.

  • Scope: it appears only for an issue assignment, not when the run is about a pull, a review or a resumed session.
  • Test: test/brief-mcp-size.test.ts builds the task for an issue naming a path, an issue naming the word, and a plain issue. The rule's lines are present in the first two and absent from the third.
  • Byte-for-byte check: the test only shows the plain brief has none of the new lines. It doesn't compare against the old output, since the old code is gone from the tree.

To try it, run bun test test/brief-mcp-size.test.ts.

Changes requested — before the latest push

The rule works for the forge repo, but the brief is built for every repository the crew works in. An MCP issue in any other app now gets told to run test/mcp-size.test.ts and read docs/MCP.md, neither of which exists there. Fix first: gate MCP_SIZE_RULE on the repo that owns that test, or on a flag the caller sets from whether the file exists in the clone, and add a test that another repo's MCP issue gets no rule. Second, the last assertion in the plain-issue test, expect(build(x)).toBe(build(x)), compares a call with itself and proves nothing. Drop it, or compare against a literal expected brief. Third, the word-boundary MCP match fires on any mention, for example an issue about a different MCP client. That is fine as a cheap trigger, but the test should show the lowercase non-trigger the description promises.

commented

I've addressed all three points and pushed to the same branch. The brief and brief-gate tests pass (10 tests); I did not run the type check this round.

  • Repo gate: the MCP rule is now added only when the repository is named forge (src/crew/brief.ts, next to the existing issue-only check). I used the repo name, not a check for the file in the clone, because taskPrompt is pure and takes no filesystem. A different app that happens to be called forge would still get the rule, and a fork of the forge keeps the name, so it gets it too.
  • Self-comparison: I removed the expect(build(x)).toBe(build(x)) assertion. The plain-issue test now only checks that the rule's lines are absent.
  • Lowercase non-trigger: a new test shows that "mcp" in lowercase prose does not trigger the rule. The match stays on the uppercase word "MCP" or a path under src/http/mcp/, so any mention of "MCP" still triggers it, such as an issue about an unrelated MCP client. I kept that as the cheap trigger you accepted.
  • Other-repo test: a new test gives an MCP issue (title and path) in a repo named square and checks it gets no rule.
Approved

Does what the issue asks and nothing more: an issue assignment on the forge repo that names MCP or src/http/mcp/ gets one paragraph telling the builder to run test/mcp-size.test.ts and extend an existing tool. test/mcp-size.test.ts and docs/MCP.md "Room for a new tool" both exist, so the pointers are true. Four tests cover path, word, plain, lowercase and other-repo cases. Small, pure, no new dependency, no UI or security surface (the preview shows no change to look at).

Two things I would do next:

  1. The repo-name gate (name === "forge") is a proxy; if briefs gain more forge-only rules, move it into one named helper rather than repeating the check.
  2. The bare word MCP also matches issues about unrelated MCP clients; if that gets noisy, narrow it to paths plus tool-file names.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs