Context
To enable autonomous agents (like Claude Desktop or Codex) to interact with our compiler tooling, we need a standardized interface. The Model Context Protocol (MCP) provides this bridge, converting our Python functions into agent-callable tools. Additionally, defining a "Skill" with documentation references allows the agent to understand how and when to use these tools effectively.
Objective
Implement the mlirAgent MCP server, a unified CLI, and the .codex skill definition to expose our deterministic tools (build, compile, trace) to AI agents.
Scope of Work
- Unified CLI (
src/mlirAgent/cli.py): * Implement a central argparse entry point wrapping run_build, run_compile, verify_output, and trace_provenance.
- Ensure it supports both direct shell usage and library import.
- Configuration (
src/mlirAgent/config.py): * Implement Config class to load paths from .env.
- Add a
validate() method to warn if IREE_SRC_PATH or ninja are missing.
- MCP Server (
src/mlirAgent/mcp_server.py): * Implement FastMCP("mlirEvolve").
- Expose tools:
build, compile_mlir, verify_ir, provenance_trace.
- Ensure error handling returns structured JSON, not Python stack traces.
- Codex Skill Definition (
.codex/skills/mlir-evolve/):
SKILL.md: Define the persona and capabilities (Build, Dialect, Provenance).
references/*.md: Add repo-map.md, infra.md, and tool-conventions.md to guide the agent's reasoning.
Acceptance Criteria
- Test 1 (CLI):
python src/mlirAgent/cli.py compile --help returns valid help text.
- Test 2 (Config):
Config.validate() correctly identifies if IREE_SRC_PATH is invalid.
- Test 3 (MCP): Starting the MCP server exposes the
provenance_trace tool with the correct argument schema (artifacts_root, source_filename, line).
- Test 4 (Documentation): The
.codex directory structure is populated, and SKILL.md correctly references the src/mlirAgent/tools/ layout.
Context
To enable autonomous agents (like Claude Desktop or Codex) to interact with our compiler tooling, we need a standardized interface. The Model Context Protocol (MCP) provides this bridge, converting our Python functions into agent-callable tools. Additionally, defining a "Skill" with documentation references allows the agent to understand how and when to use these tools effectively.
Objective
Implement the
mlirAgentMCP server, a unified CLI, and the.codexskill definition to expose our deterministic tools (build,compile,trace) to AI agents.Scope of Work
src/mlirAgent/cli.py): * Implement a centralargparseentry point wrappingrun_build,run_compile,verify_output, andtrace_provenance.src/mlirAgent/config.py): * ImplementConfigclass to load paths from.env.validate()method to warn ifIREE_SRC_PATHorninjaare missing.src/mlirAgent/mcp_server.py): * ImplementFastMCP("mlirEvolve").build,compile_mlir,verify_ir,provenance_trace..codex/skills/mlir-evolve/):SKILL.md: Define the persona and capabilities (Build, Dialect, Provenance).references/*.md: Addrepo-map.md,infra.md, andtool-conventions.mdto guide the agent's reasoning.Acceptance Criteria
python src/mlirAgent/cli.py compile --helpreturns valid help text.Config.validate()correctly identifies ifIREE_SRC_PATHis invalid.provenance_tracetool with the correct argument schema (artifacts_root,source_filename,line)..codexdirectory structure is populated, andSKILL.mdcorrectly references thesrc/mlirAgent/tools/layout.