Skip to content

nmazzoletti/midnight-opencode-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Midnight OpenCode Agent

Work in progress — the project is under active construction. Contributions, ideas, and feedback of any kind are very welcome! Feel free to open an issue or submit a pull request.

An OpenCode AI agent that helps developers build decentralized applications on the Midnight Network blockchain.

What it does

The agent handles all the surrounding complexity of a Midnight dApp — project scaffolding, package wiring, workspace configuration, API plumbing, CLI setup, and UI skeleton — so that developers can open their editor and immediately focus on what actually matters: writing the smart contract.

It is intentionally not designed to author the smart contract for you. The Compact contract is the core of your application, and that creative and architectural work should remain in the developer's hands. The agent clears everything else out of the way so that writing the contract is the first thing you do, not the tenth.

Agent architecture

.opencode/
├── agents/
│   ├── main.md                          # Orchestrator — routes tasks to sub-agents
│   └── subagents/
│       └── midnight-dapp-initializer.md # Scaffolds the full dApp folder structure
└── skills/
    └── midnight-dapp-init/              # Reusable skill: initialise a new dApp
        ├── SKILL.md                     # Skill definition and workflow
        └── templates/                   # Template files copied into new dApps
            ├── root/                    # Workspace-level files
            ├── contracts/               # Compact contract + TypeScript witnesses
            ├── api/                     # Backend API package
            ├── cli/                     # CLI package
            └── ui/                      # React frontend package

The main agent is the entry point. It analyses your request and either answers directly or delegates work to the appropriate sub-agent:

  • Information requests — questions about Midnight docs, Compact syntax, version compatibility, or example projects are answered directly by the main agent using the midnight-mcp tools.
  • Scaffolding requests — new project setup is delegated to the midnight-dapp-initializer sub-agent.

Currently available sub-agent:

Sub-agent Responsibility
midnight-dapp-initializer Creates the monorepo layout (contracts, api, cli, ui packages) from templates, fetches the latest package versions from the Midnight compatibility matrix, and wires everything together

Generated dApp structure

<your-dapp>/
└── packages/
    ├── contracts/   # Compact smart contract + TypeScript witnesses
    ├── api/         # Backend service that talks to the Midnight node
    ├── cli/         # Command-line interface for contract deployment & interaction
    └── ui/          # Frontend application

Prerequisites

  • OpenCode ≥ 1.3.3
  • Bun (agent dependency manager)
  • Node.js ≥ 20 and Yarn ≥ 4 (for generated dApps)

Getting started

# Clone the repo
git clone https://github.com/navigate226/midnight-opencode-agent
cd midnight-opencode-agent

# Launch OpenCode with this agent
opencode --agent main

Once OpenCode is running, describe the dApp you want to build and the agent will take it from there.

MCP servers

The agent uses the following Model Context Protocol servers to access Midnight-specific knowledge and tooling:

Server Source
midnight-mcp https://github.com/Olanetsoft/midnight-mcp

The server is configured in opencode.json.

About

Midnight OpenCode agent capable of helping in the coding dApps

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors