Skip to main content

Extend Midcore

Extend Midcore with project rules, custom skills and commands, lifecycle hooks, and the Model Context Protocol (MCP) for external tools. All of these are optional—the agent works out of the box with sensible defaults.

Rules

Rules are Markdown files the agent reads at session start. They define coding standards, architecture decisions, and review checklists. Place them in:

  • .midcore/rules/*.mdc — per-topic rules (e.g. one file for API conventions, one for testing)
  • AGENTS.md — project-wide instructions in project root or .midcore/

Example rule content (structure only):

markdown
# API conventions
- Use REST for public APIs; validate request bodies with the shared schema.
- Return 4xx for client errors, 5xx only for server failures.
- Document all new endpoints in the OpenAPI spec.

Priority

Rules in .midcore/rules/ can be ordered by priority. The agent applies them when planning and generating code.

Skills and commands

Custom commands package repeatable workflows so your team can run them with a single slash command. Examples:

CommandPurpose
/review-prRun code review and post feedback
/deploy-stagingRun gates, then deploy to staging
/add-testsGenerate tests for changed files

Define commands in your extension or desktop config. Each command maps to a prompt or script the agent executes. See your IDE or CLI docs for the exact configuration format.

Hooks

Hooks run shell commands or scripts before or after agent actions. Use them for formatting, linting, or custom checks. Configuration lives in:

  • .maestro/hooks.json
  • .midcore/hooks.json

Typical events you can hook into:

  • Before or after file edits
  • Before or after shell commands
  • Session start or end

Security

Hooks run with the same privileges as the agent. Only configure scripts you trust, and avoid exposing secrets in hook arguments.

MCP (Model Context Protocol)

MCP is an open standard for connecting AI tools to external data and APIs. With MCP, Midcore can read design docs, query databases (through a safe adapter), or call your internal APIs. You configure MCP servers in your environment; the agent discovers their tools and uses them when relevant to the task. Setup is environment-specific (CLI vs IDE); see Settings and your platform docs for how to add and authorize MCP servers.

Example: adding a custom rule

Create a file under .midcore/rules/ or add to AGENTS.md:

markdown
# .midcore/rules/api-conventions.mdc
- Use REST for public APIs; validate request bodies.
- Return 4xx for client errors, 5xx for server failures.
- Document new endpoints in the OpenAPI spec.

Key takeaways

  • Rules (AGENTS.md, .midcore/rules) give the agent persistent coding standards and architecture context.
  • Skills and commands package repeatable workflows; hooks run before/after agent actions.
  • MCP connects external tools and data; configure servers in your environment.
  • All extension points are optional; the agent works with sensible defaults.

Instructions & memory · Best practices · Settings