Skip to content

feat(brownfield-pack): Phase E MCP wrappers — forgeplan_render_canonical + forgeplan_export_rag #79

Description

@explosivebit

TL;DR

Implement the two Phase E wrappers for Epic ForgePlan/forgeplan#287forgeplan_render_canonical and forgeplan_export_rag. Both are thin MCP-tool wrappers over existing forgeplan-brownfield-pack skills (C10 and C12 respectively). Lives in this repo because the wrapped code is here; ForgePlan core (the other repo) cannot reach into marketplace.

Context

Epic forgeplan#287 lands 9 new MCP tools + 3 extensions in ForgePlan/forgeplan. Phases A/B/C/D/F are core work (artifact kinds, state machine, read-only inspectors, hypothesis state-machine transitions, graph extension) — those land in the core repo. Phase E is the odd-one-out: two MCP tools whose implementation is already written as brownfield-pack skills, but they're shell-style skill steps rather than callable MCP tools, so the Discover Agent v3.2 can't invoke them through mcp__forgeplan__* namespace.

The blocker: ForgePlan core has no knowledge of brownfield-pack skills (different repo, different plugin boundary). The MCP server lives in core. So the wrappers MUST live in this repo as plugin-provided tools that extend the core MCP server's tool surface via the plugin protocol (the same mechanism forgeplan-brownfield-pack already uses to ship its 12 extraction skills + 2 playbooks + 5 mappings).

What to ship

Tool 1 — forgeplan_render_canonical

Wraps: brownfield-pack skill C10.

Input:
```json
{
"domain_model_id": "DM-001",
"forms": ["ddl", "sdl", "pseudo_code"] // optional, default = all three
}
```

Output:
```json
{
"domain_model_id": "DM-001",
"ddl": "CREATE TABLE ...",
"sdl": "type User { ... }",
"pseudo_code": "# Algorithm: ...",
"diagnostics": {
"ddl_compile": true,
"sdl_parse": true,
"pseudo_code_coherence": 0.87
}
}
```

The diagnostics fields plug into forgeplan_coverage_business.canonical.* (Phase C, landing in core).

Tool 2 — forgeplan_export_rag

Wraps: brownfield-pack skill C12.

Input:
```json
{
"domain": "auth", // optional filter
"chunk_size": 800, // tokens per chunk, default 800
"include_kinds": ["use_case", "glossary", "invariant", "scenario", "hypothesis", "domain_model"]
}
```

Output:
```json
{
"export_path": ".forgeplan/rag-export-2026-05-20/",
"manifest_path": ".forgeplan/rag-export-2026-05-20/manifest.json",
"chunk_count": 142,
"total_tokens": 89234
}
```

Writes manifest.json (chunk → source-artifact mapping + token counts + content hashes) + N chunk files. Format is RAG-store-agnostic (consumer turns it into Qdrant/Lance/Chroma input).

Dependencies

  • Blocks on forgeplan#287 Phase A (artifact kinds: `domain-model`, `use_case`, `glossary`, `invariant`, `scenario`, `hypothesis`) — needs those to exist before tools can read them. I'm landing Phase A in this current session in ForgePlan/forgeplan PR for #287; will update this issue with the branch link once it's pushed.
  • Blocks on plugin-MCP-tool-extension mechanism in core (PRD-...). Need to confirm: does forgeplan's MCP server accept plugin-provided additional tools via .mcp.json declaration, or do plugin tools have to live in a separate MCP process? Read core's plugin loader before implementation.

Acceptance criteria

  • forgeplan_render_canonical registered as MCP tool on plugin install (/plugin install forgeplan-brownfield-pack)
  • forgeplan_export_rag registered same way
  • Both tools follow PRD-071 hint protocol (`_next_action` in JSON, `Next:` / `Done.` in text mode)
  • Discover Agent v3.2 (in this repo at agents/discover/) successfully invokes both via mcp__forgeplan__forgeplan_render_canonical namespace
  • At least 3 unit tests per tool (happy path + edge case + invalid input)
  • Cross-CLI smoke: same workflow runs in Claude Code, Gemini CLI, Codex CLI

References

Suggested sequencing within this work

  1. Read C10 + C12 skill code → understand input/output contracts.
  2. Read core's plugin-MCP-tool extension mechanism (if exists; if not, file a separate forgeplan issue).
  3. Implement render_canonical first — pure transform, no filesystem writes.
  4. Implement export_rag — needs disk-write discipline + manifest hashing.
  5. Add to discover-agent's protocol.json so the agent picks them up.
  6. Cross-CLI smoke test.

Tag any session agent in this repo to pick this up after forgeplan#287 Phase A lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions