Files
multica/server/internal/daemon/execenv
Eve 03ee42982b MUL-3560: gate runtime brief sections per task kind (PR 0.6)
Builds on PR 0.5's helper extraction. The dispatcher now skips
sections each task kind doesn't need, per Eve's Section × Kind
matrix on MUL-3560.

Measured impact (claude provider, full fixture with 2 repos + 10
skills, comparing PR 0.5 ↔ PR 0.6):

  kind                      PR 0.5    PR 0.6      Δ      Δ%
  ------------------------------------------------------------
  comment-triggered          19462    19462       0       0%
  assignment-triggered       18034    18034       0       0%
  autopilot-run-only         11174     8442  -2732     -24%
  quick-create               12497     4799  -7698     -62%
  chat                       11155     8423  -2732     -24%

  ✓ comment / assignment unchanged this PR (their diet comes from
    the per-section compression PRs #1..#9 on the roadmap)
  ✓ quick-create from 12.5k → 4.8k chars (-62%)
  ✓ autopilot and chat from 11k → 8k chars (-24% each)

The matrix encoded in `buildMetaSkillContent`:

  Section               | comment | assign | autopilot | quick_create | chat
  ----------------------+---------+--------+-----------+--------------+------
  Available Commands    |   full  |  full  |   full    |   minimal    | full
  Comment Formatting    |    ✓    |   ✓    |     —     |      —       |  —
  Repositories          |    △    |   △    |     △     |      —       |  △
  Project Context       |    △    |   △    |     —     |      —       |  —
  Issue Metadata        |    ✓    |   ✓    |     —     |      —       |  —
  Instruction Precedence|    —    |   ✓    |     —     |      —       |  —
  Sub-issue Creation    |    ✓    |   ✓    |     —     |      —       |  —
  Skills                |    ✓    |   ✓    |     ✓     |      —       |  ✓
  Mentions              |    ✓    |   ✓    |     —     |      —       |  —
  Attachments           |    ✓    |   ✓    |     —     |      —       |  —

What changed:

- runtime_config.go: the dispatcher now decides per kind which
  helpers to call. Always-on prelude unchanged. The matrix above
  is documented inline on `buildMetaSkillContent` and is the
  single source of truth.
- runtime_config_sections.go: new `writeAvailableCommandsQuickCreate`
  helper — emits only the `issue create` line plus the
  `multica --help` escape hatch (~500 chars vs ~4400 for the full
  variant). Used only when classifyTask returns kindQuickCreate.
- runtime_config_kind.go: `hasIssueContext` doc comment narrowed
  to the three real call sites (Project Context, Issue Metadata,
  Sub-issue Creation) per GPT-Boy's PR 0.5 review nit.
- runtime_config_kind_test.go:
  * TestBuildMetaSkillContentKindMatrix updated to encode the new
    expected section set per kind. Heading match tightened so it
    only fires on the heading line, not inline references like
    "See ## Comment Formatting below" inside Available Commands.
  * TestBuildMetaSkillContentQuickCreateAvailableCommands (new)
    locks the minimal-variant content: `issue create` is present,
    every other Core command — get / status / metadata / comment
    add / children / repo checkout / squad — is asserted absent.
- execenv_test.go: TestInjectRuntimeConfigIssueMetadataSectionScope
  now expects the metadata Core discovery lines to be ABSENT for
  quick-create (it uses the minimal Available Commands) and
  PRESENT for every other kind. Comment narrowed to match.

Verification:

- go vet ./internal/daemon/...                                       ok
- go test ./internal/daemon/... ./internal/handler/...               ok

Backwards compatibility:

- InjectRuntimeConfig signature unchanged (still 2-tuple).
- No new daemon flags, no new ctx fields, no per-provider changes.
- Reverting this commit restores PR 0.5 byte-for-byte; the change
  is contained inside buildMetaSkillContent's section selection.

Risk and follow-up:

- comment-triggered and assignment-triggered still ~19k each;
  their reduction lands in PRs #1 (Available Commands compression),
  #4 (Mentions compression), #5 (Issue Metadata compression).
- The full Available Commands variant retains "See ## Comment
  Formatting below" as an inline reference, which is now a
  dangling pointer for autopilot/chat where Comment Formatting is
  gated out. Cleanup deferred to PR #1 of the roadmap (Available
  Commands compression) — addressing it requires kind-specific
  Available Commands variants, which is exactly that PR's
  surface.

Co-authored-by: multica-agent <github@multica.ai>
2026-06-23 14:48:24 +08:00
..