Nguyen Khac Trung Kien
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Oh-My-OpenCode with OCX Profiles This document describes the architecture of oh-my-opencode when used with OCX profiles and provides guidance on creating new profiles. ## Architecture Overview ### OCX and Profile System OCX (OpenCode eXtensions) is a package manager for OpenCode that provides global profiles for portable, isolated configurations. Profiles allow you to work in any repository without modifying the project, using your own complete configuration. ``` ┌─────────────────────────────────────────────────────────────────┐ │ Your Development Machine │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ ~/.config/opencode/ │ │ ├── opencode.jsonc # Global base configuration │ │ └── profiles/ # Profile configurations │ │ ├── omooss/ # Your primary oh-my-opencode │ │ │ ├── ocx.jsonc # OCX isolation settings │ │ │ ├── opencode.jsonc # OpenCode config + plugin │ │ │ ├── oh-my-opencode.json # Agent definitions │ │ │ └── AGENTS.md # Profile instructions │ │ └── other-profile/ # Additional profiles │ │ ├── ocx.jsonc │ │ └── opencode.jsonc │ │ │ └─────────────────────────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ Any Repository │ │ │ │ /home/user/oss/some-project/ │ │ ├── src/ │ │ ├── AGENTS.md # Isolated - not loaded by profile │ │ └── .opencode/ # Isolated - not loaded by profile │ │ │ │ When you run: ocx opencode -p omooss │ │ OpenCode launches HERE with your profile config │ └─────────────────────────────────────────────────────────────────┘ ``` ### Profile Resolution Priority When launching OpenCode, the profile is resolved in this order: 1. `--profile <name>` / `-p <name>` flag (explicit override) 2. `OCX_PROFILE` environment variable 3. `default` profile (if it exists) 4. No profile (uses base configs only) ### Configuration Isolation Model OCX implements a strict isolation model for security and portability: **Registry Isolation:** - Global registries (in `~/.config/opencode/ocx.jsonc`) - only for downloading profiles - Profile registries (in profile's `ocx.jsonc`) - only available when using that profile - Local registries (in project's `.opencode/ocx.jsonc`) - only for that project This prevents global registries from injecting components into all projects. **OpenCode Config Merging:** - Profile's `opencode.jsonc` merges with local (if not excluded by patterns) - Profile's exclude/include patterns control which project instruction files OpenCode can see - Include patterns override exclude patterns (TypeScript/Vite style) **Default Exclude Patterns:** ```jsonc { "exclude": [ "**/AGENTS.md", // Don't load project's AGENTS.md "**/CLAUDE.md", // Don't load project's CLAUDE.md "**/CONTEXT.md", // Don't load project's CONTEXT.md "**/.opencode/**", // Don't load project's .opencode/ "**/opencode.jsonc", // Don't load project's opencode.jsonc "**/opencode.json" // Don't load project's opencode.json ] } ``` ### Profile File Structure Each profile contains these core files: ``` ~/.config/opencode/profiles/<profile-name>/ ├── ocx.jsonc # OCX-specific settings ├── opencode.jsonc # OpenCode configuration ├── oh-my-opencode.json # Oh-My-OpenCode agent definitions (optional) └── AGENTS.md # Profile-specific instructions (optional) ``` #### ocx.jsonc The OCX configuration file for the profile: ```jsonc { "$schema": "https://ocx.kdco.dev/schemas/ocx.json", "registries": {}, // Profile-specific registries "renameWindow": true, // Rename terminal window with profile info "bin": "/path/to/opencode", // Custom OpenCode binary (optional) "exclude": [...], // Exclude patterns for file discovery "include": [], // Include patterns (override excludes) "componentPath": ".opencode" // Where to install components } ``` #### opencode.jsonc The OpenCode configuration for the profile: ```jsonc { "model": "cliproxy/claude-sonnet-4-5-thinking", "permission": { "question": "allow" }, "plugin": ["oh-my-opencode@latest"], // Load oh-my-opencode "provider": { ... } // AI provider configuration } ``` #### oh-my-opencode.json The core configuration defining agents, categories, and skills with their models and behavior. This is a complex JSON structure that maps: - **Agents**: Specialized AI agents (Sisyphus, Oracle, Librarian, Explore, etc.) - **Categories**: Task categories (visual-engineering, ultrabrain, quick, etc.) - **Skills**: Reusable task-specific instructions (playwright, git-master, etc.) ```jsonc { "agents": { "sisyphus": { "model": "cliproxyoss/minimaxai/minimax-m2.1", "temperature": 0.1, "prompt_append": "Additional instructions..." }, "oracle": { ... }, "librarian": { ... } }, "categories": { "quick": { ... }, "visual-engineering": { ... } }, "skills": { "playwright": { ... }, "git-master": { ... } } } ``` ## Creating Profiles ### Method 1: Create a Blank Profile Create a new profile from scratch: ```bash # Initialize global profiles first (one-time) ocx init --global # Create a new blank profile ocx profile add myprofile # Edit the profile configuration ocx config edit -p myprofile ``` This creates: ``` ~/.config/opencode/profiles/myprofile/ ├── ocx.jsonc # With default settings └── opencode.jsonc # Empty config ``` ### Method 2: Clone from Existing Profile Copy an existing profile as a starting point: ```bash # Clone from your omooss profile ocx profile add work --from omooss # Customize it ocx config edit -p work ``` ### Method 3: Install from Registry Use a pre-configured profile from a registry: ```bash # Add a registry with profiles ocx registry add https://registry.kdco.dev --name kdco --global # Install a profile from the registry ocx profile add minimal --from kdco/minimal ``` ### Method 4: Manual Creation Create a profile manually by creating the directory structure: ```bash mkdir -p ~/.config/opencode/profiles/myprofile ``` Then create the required files manually (see File Structure Reference below). ## Profile Configuration Guide ### Setting Up AI Providers In `~/.config/opencode/profiles/<name>/opencode.jsonc`: ```jsonc { "model": "cliproxy/claude-sonnet-4-5-thinking", "permission": { "question": "allow" }, "plugin": ["oh-my-opencode@latest"], "provider": { "cliproxy": { "name": "Cliproxy", "npm": "@ai-sdk/cli", "options": { "baseURL": "http://localhost:8317/v1" }, "models": { "claude-sonnet-4-5-thinking": { "name": "Claude Sonnet 4.5 Thinking" } } } } } ``` ### Configuring Oh-My-OpenCode Agents In `~/.config/opencode/profiles/<name>/oh-my-opencode.json`: ```jsonc { "agents": { "sisyphus": { "model": "cliproxyoss/minimaxai/minimax-m2.1", "temperature": 0.1, "prompt_append": "Your custom instructions here" }, "oracle": { "model": "cliproxyoss/z-ai/glm4.7", "temperature": 0.1 } }, "categories": { "quick": { "model": "cliproxyoss/z-ai/glm4.7", "temperature": 0.2 }, "ultrabrain": { "model": "cliproxyoss/moonshotai/kimi-k2-thinking", "temperature": 0.1 } }, "skills": { "playwright": { "mcp": "playwright" }, "git-master": { "mcp": null } } } ``` ### Customizing File Visibility Modify `exclude` and `include` patterns in `ocx.jsonc`: ```jsonc { "exclude": [ "**/AGENTS.md", "**/CLAUDE.md", "**/CONTEXT.md", "**/.opencode/**", "**/opencode.jsonc", "**/opencode.json" ], "include": [ "./docs/AGENTS.md", ".opencode/skills/**" ] } ``` ### Using Custom OpenCode Binary ```jsonc { "bin": "/usr/local/bin/opencode-dev" } ``` ### Adding Profile-Specific Instructions Create or edit `~/.config/opencode/profiles/<name>/AGENTS.md`: ```markdown # Profile-Specific Instructions These instructions apply when using this profile. ## Project Context - This profile is configured for [purpose] - Uses [model] as primary model ## Special Instructions - [Your custom instructions here] ``` ## File Structure Reference ### Complete Profile Structure ``` ~/.config/opencode/ ├── opencode.jsonc # Global base config └── profiles/ └── <profile-name>/ # Profile directory ├── ocx.jsonc # OCX settings │ ├── registries # Profile-specific registries │ ├── renameWindow # Terminal window naming │ ├── bin # Custom OpenCode binary path │ ├── componentPath # Component installation path │ ├── exclude # File exclusion patterns │ └── include # File inclusion patterns (override exclude) │ ├── opencode.jsonc # OpenCode configuration │ ├── model # Default model │ ├── permission # Permission settings │ ├── plugin # npm plugins │ └── provider # AI provider configuration │ ├── oh-my-opencode.json # Oh-My-OpenCode configuration │ ├── agents # Agent definitions │ ├── categories # Task category assignments │ └── skills # Skill configurations │ ├── AGENTS.md # Profile-specific instructions │ └── .opencode/ # Profile components (optional) ├── agent/ # Installed agents ├── skill/ # Installed skills └── plugin/ # Installed plugins ``` ### Your Current Setup (omooss) ``` ~/.config/opencode/ ├── opencode.jsonc # 4 AI providers via local proxy └── profiles/ └── omooss/ ├── ocx.jsonc # Empty registries, full isolation ├── opencode.jsonc # Includes oh-my-opencode plugin ├── oh-my-opencode.json # Complete agent/category/skill definitions ├── AGENTS.md # Custom instructions (empty) └── node_modules/ # Dependencies (@opencode-ai, zod) ``` ## Profile Management Commands ### Essential Commands ```bash # List all profiles ocx profile list ocx p ls # Create new profile ocx profile add <name> # Clone from existing profile ocx profile add <name> --from <source-profile> # Install from registry ocx profile add <name> --from <registry>/<profile> # Delete profile ocx profile remove <name> ocx p rm <name> # Display profile contents ocx profile show <name> ocx p show <name> # Edit profile config ocx config edit -p <name> # Launch with profile ocx opencode -p <name> ``` ### Configuration Commands ```bash # Show current configuration ocx config show # Show config with source annotations ocx config show --origin # Edit global config ocx config edit --global # Edit local config (in current project) ocx config edit ``` ## Quick Start: Creating Your Own Profile 1. **Initialize global profiles:** ```bash ocx init --global ``` 2. **Create a new profile:** ```bash ocx profile add myprofile ``` 3. **Configure AI providers** in `opencode.jsonc`: ```bash ocx config edit -p myprofile ``` 4. **Add oh-my-opencode** plugin (optional): ```jsonc { "plugin": ["oh-my-opencode@latest"] } ``` 5. **Configure agents** in `oh-my-opencode.json` (create if needed): ```bash cat > ~/.config/opencode/profiles/myprofile/oh-my-opencode.json << 'EOF' { "agents": { "sisyphus": { "model": "your-provider/your-model", "temperature": 0.1 } } } EOF ``` 6. **Launch OpenCode:** ```bash ocx opencode -p myprofile ``` 7. **Set as default** (optional): ```bash export OCX_PROFILE=myprofile ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully