Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

apex-fast

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apex-fast

Fast Apply is a tool that you give to your AI agent that allows it to edit code or files.

latest
Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

apex-fast

apex-fast is a plugin for OpenCode AI that integrates Morph Fast Apply — an AI model specialized for code editing boasting 10,500+ tokens/second speeds and 98% accuracy. This plugin overrides the built-in edit tool with morph_edit, which is significantly faster for large files and complex changes.

✨ Features

  • 10x Faster — Uses partial snippets, no need to read the entire file
  • 🧠 Smart Routing — Automatically selects morph-v3-fast or morph-v3-large models based on instruction complexity
  • 🔒 Overrides edit Tool — Blocks the built-in edit tool and directs the AI to use fastApply instead
  • 🛡️ Pre-flight Validation & Readonly Agents Protection — Prevents catastrophic accidental deletions and disables edits in plan or explore modes.
  • 🛠️ MCP Server — Can be run as a standalone MCP server (local via stdio or remote via SSE)

🚀 Installation

Step 1: Get Morph API Key

Sign up and get your API key at morphllm.com.

Step 2: Configure Plugin in OpenCode

Edit your ~/.config/opencode/opencode.json file and add the plugin:

{
  "plugin": ["apex-fast@latest"],
  "instructions": ["Follow Instructions in `~/.config/opencode/Morph-Rules.md`"]
}

Note: The "instructions" field tells the AI to read Morph-Rules.md as its guide on when to use fastApply vs other tools.

Step 3: Install Morph-Rules.md (REQUIRED)

The Morph-Rules.md file acts as the primary behavioral guideline for the AI. You must copy it into your OpenCode config directory. Without it, the AI won't know how to use morph_edit properly.

# Download Morph-Rules.md into your OpenCode config directory
curl -o ~/.config/opencode/Morph-Rules.md \
  https://raw.githubusercontent.com/yunaamelia/apex-fast/main/Morph-Rules.md

Alternatively, manually copy it from this repository.

Step 4: Set Environment Variable

The plugin requires the MORPH_API_KEY to be available in your environment.

Permanent approach (recommended):

# Add to ~/.bashrc or ~/.zshrc
echo 'export MORPH_API_KEY="sk-your-key-here"' >> ~/.bashrc
source ~/.bashrc

Or add it directly to a .env file in your working directory:

MORPH_API_KEY=sk-your-key-here

🛠️ Using the fastApply Tool

Once the plugin is active, your AI will have access to the fastApply tool. Use the syntax // ... existing code ... as a marker for unchanged code.

Parameters

ParameterTypeRequiredDescription
filePathstringRelative path to the file you want to edit
instructionsstringSpecific instructions detailing what to change
codeEditstringPartial code snippet using // ... existing code ... markers

Usage Examples

Adding a new function:

// ... existing code ...
import { newDep } from './newDep';
// ... existing code ...

function newFeature() {
  return newDep.process();
}
// ... existing code ...

Modifying existing code:

// ... existing code ...
function existingFunc(param) {
  // Updated implementation
  const result = param * 2; // Changed from * 1
  return result;
}
// ... existing code ...

⚠️ IMPORTANT: Always include // ... existing code ... at the beginning and end of your snippet. Otherwise, Morph will delete the code outside of the snippet.

📋 Tool Selection Guide

SituationToolReason
Small & exact string replacementeditFastest, no API call
Simple variable/function renameeditPrecise, no AI needed
Large files (300+ lines)fastApply10x faster, partial snippets
Multiple scattered changesfastApplyBatch changes in one pass
Complex refactoringfastApplyAI parses context better
Whitespace-sensitive editsfastApplyHigh tolerance for formatting differences

🖥️ Running as an MCP Server (Optional)

This plugin can also run as a standalone MCP Server for use with other MCP clients (like Claude Desktop).

Stdio Mode (Default)

MORPH_API_KEY=sk-your-key npx apex-fast-mcp

SSE Mode (Remote/HTTP)

MORPH_API_KEY=sk-your-key npx apex-fast-mcp sse 3000

The server will run on:

  • SSE Endpoint: http://localhost:3000/sse
  • Message Endpoint: http://localhost:3000/message

⚠️ Troubleshooting

Error: [ERROR] Missing MORPH_API_KEY

The plugin cannot find the API key. Ensure:

  • The MORPH_API_KEY environment variable is set
  • If using .env, the file exists in the current working directory

Error: [ERROR] Failed to read file

The specific filePath cannot be read. Ensure:

  • The path provided is relative to the current working directory
  • The file actually exists

Pre-flight Validation Error

If you attempt to edit a large file (>10 lines) and omit the // ... existing code ... markers, the plugin will block the tool call to prevent catastrophic code loss. The AI should simply rewrite the codeEdit parameter correctly wrapped inside markers.

Fallback Behavior for Morph API Failure

If Morph API times out or rate limits:

  • The plugin will return an error message containing the specifics
  • The AI can fall back to using the built-in edit tool
  • The built-in edit tool requires exact string matching

🔧 Development

mise run build     # Build the project
mise run test      # Run the test suite
mise run lint      # Lint the code
mise run lint:fix  # Automatically fix linting issues

📦 Release

See the RELEASE.md file for instructions on how to release a new version.

🤝 Contributing

Contributions are very welcome! Please open an issue or submit a pull request on the GitHub repository.

📄 License

See the LICENSE file for details.

FAQs

Package last updated on 21 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts