Skip to content

feat: presets + installer + CLI subcommands#1

Merged
marceloceccon merged 3 commits intomainfrom
feat/presets-and-installer
Apr 30, 2026
Merged

feat: presets + installer + CLI subcommands#1
marceloceccon merged 3 commits intomainfrom
feat/presets-and-installer

Conversation

@marceloceccon
Copy link
Copy Markdown
Member

Summary

Consumer-side half of the v0.11 work. Adds five task-tuned preset MCP tools, a host-detecting install subcommand for the top three IDE/host environments (Claude Code, Cursor, Windsurf), and an MCP-registry manifest. Backward compatible end-to-end: existing 0.10 host configs and the generic consensus tool are byte-identical to before, and a bare ai-consensus-mcp --config X still works exactly as it did.

The matching tool-calling integration is deferred until ai-consensus-core@0.11.0 merges and publishes — see Phase 3 in progress.md. This PR covers Phases 0/1/4; Phase 2 lives upstream; Phase 3 unblocks once the core ships.

What ships in this PR

Five preset MCP tools

Each preset is registered as its own tool so MCP hosts surface them in autocomplete:

Tool Panel Rounds Temp Output
consensus_code_review pessimist + domain-expert + devils-advocate + first-principles 3 0.3 BLOCKER/MAJOR/MINOR/NIT findings + recommended fixes
consensus_architecture_debate first-principles + domain-expert + vc-specialist + pessimist 4 0.6 Decision matrix + recommendation + flip conditions
consensus_research_synthesis scientific-skeptic + domain-expert + first-principles + optimistic-futurist 4 0.4 Citation-first claims with HIGH/MEDIUM/LOW confidence
consensus_decision_making vc-specialist + pessimist + domain-expert + devils-advocate 4 0.5 Ranked options with EV / risks / upsides
consensus_debug_postmortem pessimist + domain-expert + first-principles + scientific-skeptic 3 0.3 Postmortem report (timeline, 5-whys, remediation)

Implementation: src/presets/{types,registry,resolve-panel,build-input-schema,format}.ts plus src/presets/definitions/*.ts. Panel resolution is non-destructive — preset task suffixes are appended to fresh persona objects, never mutating the global PERSONAS table. Fallback chains and a used-persona guard prevent double-binding. Snapshot tests lock the resolved system prompts (6 inline snapshots).

Preset tools deliberately do not expose participantIds — the panel is the preset's responsibility. If your config can't satisfy a preset's required personas, the tool description prefixes ⚠ Currently NOT RUNNABLE and the tool-call error names the missing personas.

Installer subcommand

ai-consensus-mcp install --config /abs/path/to/consensus.config.json

Detects Claude Code / Cursor / Windsurf and registers an entry in each one's mcpServers map. Atomic write (write-to-tmp, rename), never clobbers siblings (Claude Code's .claude.json holds far more than mcpServers), idempotent (re-runs report alreadyPresent), refuses to overwrite a different existing entry without --force. Tested with mkdtemp-rooted fake \$HOME directories so CI runs without touching the real home.

Flags: --hosts, --name, --command, --force, --list-hosts, --help. The bare ai-consensus-mcp --config X invocation still routes to serve (full backward compat with 0.10).

Foundations

  • ESLint v10 (flat config) + typescript-eslint v8 + Prettier v3.8 — npm run lint, npm run format:check, npm run check
  • vitest 2.1.8 → 4.1.5 (clears 6 moderate audit findings via esbuild < 0.24.2; aligns with upstream)
  • Coverage thresholds in vitest.config.ts with a src/presets/** gate at 90/75/95/90
  • scripts/smoke-stdio.mjs — handshake smoke test (no API keys needed)
  • CI flow: npm installnpm run checknpm run buildnpm run test:smoke

Registry manifest

server.json at repo root, schema-keyed to https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json. Once published, submit to registry.modelcontextprotocol.io so universal installers like npx add-mcp ai-consensus-mcp pick it up.

Docs

  • README "Install in 30 seconds" + Presets reference table
  • docs/install.md — long-form install reference (per-host details, Cursor deeplink format, manual fallback)
  • CHANGELOG.md initialised

Test plan

  • npm run check (typecheck + lint + format:check + test:coverage): 120/120 tests pass; coverage 65.1% global, 96.6% on src/presets/, 85%+ on src/installer/
  • npm run build && npm run test:smoke — 6 tools advertised end-to-end
  • node dist/index.js install --list-hosts reports detection correctly
  • node dist/index.js install --help shows the install help
  • node dist/index.js --version returns 0.10.0
  • node dist/index.js --config <path> (no subcommand) still routes to serve
  • Existing 0.10 server.test.ts assertions updated where the surface changed (the legacy "exactly one tool" assertion now expects 6 — visible in the diff)

Why this is shaped this way

  • One tool per preset, plus the existing consensus. Presets need to be discoverable in host autocomplete; a single consensus tool with a preset parameter would be invisible. Generic consensus stays for power users.
  • Pure data preset definitions. No runtime side-effects in the definition modules — each preset is a plain object exporting panel, defaults, judgeSystemPrompt, etc. Snapshot tests lock the resolved prompts so a careless edit can't silently change behaviour.
  • Adapter takes provider map per call. Preset runs may resolve a participant set the user's raw config doesn't expose verbatim; the adapter signature now takes {providers, providerByParticipant} per-call instead of closing over the full LoadedConfig.
  • Installer is merge-only. Every host's config holds far more than just mcpServers. Atomic write + per-key merge protects user state.
  • CLI subcommands keep 0.10 invocations identical. serve is the implicit default; --config X (no subcommand, leading flag) still routes to serve so existing host configs work without edits.

Deferred (planned for next minors)

  • Tool-calling integration — depends on ai-consensus-core@0.11.0 publishing (see feat: add tool-calling primitives (0.11.0) ai-consensus-core#3). Will add tools.upstreamServers config, MCP composition, executor + redaction, updated presets that bind tools.
  • docs/install.html for GitHub Pages with a Cursor one-click button.
  • --verify flag to run a smoke test post-install.
  • --init-config flag to bootstrap a starter config.
  • CI installer matrix that validates produced JSON against host schemas.
  • Config-side preset overrides (mergePresets infrastructure in place; no consumer asking yet).

Version policy

package.json.version is left at 0.10.0 in this PR — happy to bump on the same branch, or leave it for the release commit so 0.11.0 lines up with the upstream tool-calling release. Open question for you to call.

Adds five task-tuned preset MCP tools, a host-detecting installer
subcommand for Claude Code / Cursor / Windsurf, and an MCP-registry
manifest. Backward compatible — the existing `consensus` tool's input,
output, progress contract and config schema are unchanged, and a bare
`ai-consensus-mcp --config X` invocation still routes to `serve` exactly
as in 0.10.

Highlights:

  • src/presets/* — Preset/PresetPanelEntry/PresetDefaults types,
    registry+merge, panel resolution with fallbacks, JSON-schema +
    zod input parser, judge-first markdown formatter, and the five
    built-in definitions (code_review, architecture_debate,
    research_synthesis, decision_making, debug_postmortem).

  • src/server.ts — registers `consensus` + 5 preset tools; dispatches
    by name; runnability check surfaces missing personas in the tool
    description and tool-call error.

  • src/cli/* — main dispatcher with `serve` (default, backward compat)
    and `install` subcommands. SERVER_NAME/SERVER_VERSION moved into
    src/version.ts as a single source of truth.

  • src/installer/* — atomic merge into mcpServers without clobbering
    siblings. Detection by config-path + parent-dir + extra-dir
    heuristics. fakeHome support for tests.

  • Foundations — ESLint + Prettier (flat config), vitest 4.1.5
    (clears 6 moderate audit findings), coverage thresholds, smoke
    test, npm run check aggregator.

  • README "Install in 30 seconds" + per-preset table.
    docs/install.md long-form reference. server.json registry manifest.

Tests: 24 → 120 (+96 new). Coverage 65.1% global / 90+% on src/presets.
Smoke: 6 tools advertised end-to-end.

Tool-calling integration ships in a follow-up release that bumps
ai-consensus-core to ^0.11.0 once entropyvortex/ai-consensus-core#3
merges and publishes. See CHANGELOG.md for the full breakdown and the
deferred follow-up list.
The previous commits to these files bypassed the prettier write step;
CI was rejecting them on prettier --check. No content changes — just
line-wrap and trailing-newline normalisation.
@marceloceccon marceloceccon merged commit 2d9a8b0 into main Apr 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant